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:
+10
-9
@@ -26,10 +26,13 @@ BEGIN
|
||||
AND column_name = 'paymentMethodsEnabled'
|
||||
) THEN
|
||||
UPDATE "brand_settings"
|
||||
SET "paymentMethodsEnabled" = ARRAY(
|
||||
SELECT x
|
||||
FROM unnest("paymentMethodsEnabled") AS x
|
||||
WHERE x::text <> 'STRIPE'
|
||||
SET "paymentMethodsEnabled" = COALESCE(
|
||||
ARRAY(
|
||||
SELECT x
|
||||
FROM unnest("paymentMethodsEnabled") AS x
|
||||
WHERE x::text <> 'STRIPE'
|
||||
),
|
||||
ARRAY[]::"PaymentProvider"[]
|
||||
)
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
@@ -107,15 +110,13 @@ BEGIN
|
||||
AND table_name = 'brand_settings'
|
||||
AND column_name = 'paymentMethodsEnabled'
|
||||
) 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 COLUMN "paymentMethodsEnabled" TYPE "PaymentProvider_new"[]
|
||||
USING (
|
||||
COALESCE(
|
||||
ARRAY(
|
||||
SELECT x::text::"PaymentProvider_new"
|
||||
FROM unnest("paymentMethodsEnabled") AS x
|
||||
WHERE x::text <> 'STRIPE'
|
||||
),
|
||||
"paymentMethodsEnabled"::text[]::"PaymentProvider_new"[],
|
||||
ARRAY[]::"PaymentProvider_new"[]
|
||||
)
|
||||
);
|
||||
|
||||
@@ -155,8 +155,8 @@ async function main() {
|
||||
}
|
||||
|
||||
// Prisma records a failed transactional migration even after the SQL rolls back.
|
||||
// In local/dev Docker that leftover row blocks every subsequent startup.
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// That leftover row blocks every subsequent Docker/startup deploy.
|
||||
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.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user