fix migration production
Build & Push / Pipeline Tests (push) Successful in 1m56s
Test / Type Check (all packages) (push) Successful in 55s
Build & Push / Build & Push Docker Image (push) Successful in 3m34s
Test / API Unit Tests (push) Successful in 1m12s
Test / Homepage Unit Tests (push) Successful in 49s
Test / Carplace Unit Tests (push) Successful in 41s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 45s
Test / API Integration Tests (push) Successful in 1m6s
Build & Push / Pipeline Tests (push) Successful in 1m56s
Test / Type Check (all packages) (push) Successful in 55s
Build & Push / Build & Push Docker Image (push) Successful in 3m34s
Test / API Unit Tests (push) Successful in 1m12s
Test / Homepage Unit Tests (push) Successful in 49s
Test / Carplace Unit Tests (push) Successful in 41s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 45s
Test / API Integration Tests (push) Successful in 1m6s
This commit is contained in:
+7
-6
@@ -26,10 +26,13 @@ BEGIN
|
|||||||
AND column_name = 'paymentMethodsEnabled'
|
AND column_name = 'paymentMethodsEnabled'
|
||||||
) THEN
|
) THEN
|
||||||
UPDATE "brand_settings"
|
UPDATE "brand_settings"
|
||||||
SET "paymentMethodsEnabled" = ARRAY(
|
SET "paymentMethodsEnabled" = COALESCE(
|
||||||
|
ARRAY(
|
||||||
SELECT x
|
SELECT x
|
||||||
FROM unnest("paymentMethodsEnabled") AS x
|
FROM unnest("paymentMethodsEnabled") AS x
|
||||||
WHERE x::text <> 'STRIPE'
|
WHERE x::text <> 'STRIPE'
|
||||||
|
),
|
||||||
|
ARRAY[]::"PaymentProvider"[]
|
||||||
)
|
)
|
||||||
WHERE EXISTS (
|
WHERE EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
@@ -107,15 +110,13 @@ BEGIN
|
|||||||
AND table_name = 'brand_settings'
|
AND table_name = 'brand_settings'
|
||||||
AND column_name = 'paymentMethodsEnabled'
|
AND column_name = 'paymentMethodsEnabled'
|
||||||
) THEN
|
) THEN
|
||||||
|
-- PostgreSQL rejects subqueries in ALTER ... USING. STRIPE was already
|
||||||
|
-- filtered out above, so a text-array recast is enough.
|
||||||
ALTER TABLE "brand_settings"
|
ALTER TABLE "brand_settings"
|
||||||
ALTER COLUMN "paymentMethodsEnabled" TYPE "PaymentProvider_new"[]
|
ALTER COLUMN "paymentMethodsEnabled" TYPE "PaymentProvider_new"[]
|
||||||
USING (
|
USING (
|
||||||
COALESCE(
|
COALESCE(
|
||||||
ARRAY(
|
"paymentMethodsEnabled"::text[]::"PaymentProvider_new"[],
|
||||||
SELECT x::text::"PaymentProvider_new"
|
|
||||||
FROM unnest("paymentMethodsEnabled") AS x
|
|
||||||
WHERE x::text <> 'STRIPE'
|
|
||||||
),
|
|
||||||
ARRAY[]::"PaymentProvider_new"[]
|
ARRAY[]::"PaymentProvider_new"[]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -155,8 +155,8 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prisma records a failed transactional migration even after the SQL rolls back.
|
// Prisma records a failed transactional migration even after the SQL rolls back.
|
||||||
// In local/dev Docker that leftover row blocks every subsequent startup.
|
// That leftover row blocks every subsequent Docker/startup deploy.
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.DB_DEPLOY_SKIP_FAILED_RETRY === 'true') {
|
||||||
console.error('[db:deploy] Found failed migrations in a non-empty database. Resolve them manually before deploying again.')
|
console.error('[db:deploy] Found failed migrations in a non-empty database. Resolve them manually before deploying again.')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user