Release: weekly deploy
This commit is contained in:
+5
-2
@@ -19,8 +19,11 @@ CREATE INDEX IF NOT EXISTS entity_translations_lookup_idx
|
|||||||
CREATE INDEX IF NOT EXISTS entity_translations_locale_field_idx
|
CREATE INDEX IF NOT EXISTS entity_translations_locale_field_idx
|
||||||
ON entity_translations (locale, field_name);
|
ON entity_translations (locale, field_name);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS entity_translations_value_lower_idx
|
-- Search only matches name/title aliases; exclude long prose (bio_full) from btree index.
|
||||||
ON entity_translations (locale, lower(value));
|
DROP INDEX IF EXISTS entity_translations_value_lower_idx;
|
||||||
|
CREATE INDEX IF NOT EXISTS entity_translations_search_alias_idx
|
||||||
|
ON entity_translations (locale, lower(value))
|
||||||
|
WHERE field_name IN ('name', 'title') AND char_length(value) <= 512;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION entity_translations_touch_updated_at()
|
CREATE OR REPLACE FUNCTION entity_translations_touch_updated_at()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"thumbnails": true,
|
"thumbnails": true,
|
||||||
"backupDev": true,
|
"backupDev": true,
|
||||||
"backupProd": true,
|
"backupProd": true,
|
||||||
"migrateProdSchema": false,
|
"migrateProdSchema": true,
|
||||||
"restoreProd": true,
|
"restoreProd": true,
|
||||||
"syncImages": true,
|
"syncImages": true,
|
||||||
"dockerPublish": true,
|
"dockerPublish": true,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ Set-Location $RepoRoot
|
|||||||
$BannerWidth = 64
|
$BannerWidth = 64
|
||||||
$CompletedSteps = [System.Collections.Generic.List[string]]::new()
|
$CompletedSteps = [System.Collections.Generic.List[string]]::new()
|
||||||
$FailedStep = $null
|
$FailedStep = $null
|
||||||
|
$script:ProdSchemaMigrated = $false
|
||||||
|
|
||||||
function Write-ReleaseBanner {
|
function Write-ReleaseBanner {
|
||||||
param([bool]$Success, [string]$FailedAt = '')
|
param([bool]$Success, [string]$FailedAt = '')
|
||||||
@@ -165,14 +166,12 @@ function Get-ProfileSteps {
|
|||||||
$base.thumbnails = $true
|
$base.thumbnails = $true
|
||||||
$base.backupDev = $true
|
$base.backupDev = $true
|
||||||
$base.backupProd = $true
|
$base.backupProd = $true
|
||||||
|
$base.migrateProdSchema = $true
|
||||||
$base.restoreProd = $true
|
$base.restoreProd = $true
|
||||||
$base.syncImages = $true
|
$base.syncImages = $true
|
||||||
$base.dockerPublish = $true
|
$base.dockerPublish = $true
|
||||||
$base.truenasRestartPause = $true
|
$base.truenasRestartPause = $true
|
||||||
$base.verify = $true
|
$base.verify = $true
|
||||||
if ($SchemaChanged) {
|
|
||||||
$base.migrateProdSchema = $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,21 +516,36 @@ if (Get-StepEnabled $steps 'backupProd') {
|
|||||||
if (-not $ok) { Write-ReleaseBanner -Success $false -FailedAt $FailedStep; exit 1 }
|
if (-not $ok) { Write-ReleaseBanner -Success $false -FailedAt $FailedStep; exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Invoke-MigrateProdSchema {
|
||||||
|
Assert-ProdDbTarget
|
||||||
|
$env:DB_NAME = 'gallery_prod'
|
||||||
|
try {
|
||||||
|
$code = Invoke-Npm 'dev:migrate'
|
||||||
|
if ($code -eq 0) {
|
||||||
|
$script:ProdSchemaMigrated = $true
|
||||||
|
}
|
||||||
|
return $code
|
||||||
|
} finally {
|
||||||
|
Remove-Item Env:\DB_NAME -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-StepEnabled $steps 'migrateProdSchema') {
|
if (Get-StepEnabled $steps 'migrateProdSchema') {
|
||||||
$ok = Invoke-Step 'migrateProdSchema' {
|
$ok = Invoke-Step 'migrateProdSchema' {
|
||||||
Assert-ProdDbTarget
|
return (Invoke-MigrateProdSchema)
|
||||||
$env:DB_NAME = 'gallery_prod'
|
|
||||||
try {
|
|
||||||
$code = Invoke-Npm 'dev:migrate'
|
|
||||||
return $code
|
|
||||||
} finally {
|
|
||||||
Remove-Item Env:\DB_NAME -ErrorAction SilentlyContinue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (-not $ok) { Write-ReleaseBanner -Success $false -FailedAt $FailedStep; exit 1 }
|
if (-not $ok) { Write-ReleaseBanner -Success $false -FailedAt $FailedStep; exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Get-StepEnabled $steps 'restoreProd') {
|
if (Get-StepEnabled $steps 'restoreProd') {
|
||||||
|
if (-not $script:ProdSchemaMigrated) {
|
||||||
|
Write-Host 'Auto-running migrateProdSchema before restoreProd (prod schema must match dev backup).' -ForegroundColor Yellow
|
||||||
|
$ok = Invoke-Step 'migrateProdSchema' {
|
||||||
|
return (Invoke-MigrateProdSchema)
|
||||||
|
}
|
||||||
|
if (-not $ok) { Write-ReleaseBanner -Success $false -FailedAt $FailedStep; exit 1 }
|
||||||
|
}
|
||||||
|
|
||||||
$ok = Invoke-Step 'restoreProd' {
|
$ok = Invoke-Step 'restoreProd' {
|
||||||
Assert-ProdDbTarget
|
Assert-ProdDbTarget
|
||||||
if (-not $script:backupFile) {
|
if (-not $script:backupFile) {
|
||||||
|
|||||||
Reference in New Issue
Block a user