deploy: after a failed migration, mark it rolled back so later deploys aren't blocked
Found in the VM test: Prisma records a failed migration and then refuses every later migrate deploy (P3009), so one broken release left a church unable to update. On rollback, failed migrations the previous release doesn't have are marked rolled back (prisma migrate resolve); the backup still has the database as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -303,6 +303,12 @@ deploy_product() {
|
||||
return 0
|
||||
fi
|
||||
warn "$p: deploy failed. Going back to $prev (database migrations aren't undone; the backup has the database as it was)."
|
||||
# A migration that failed is recorded as failed, and Prisma then refuses every later deploy
|
||||
# (P3009) until it's resolved. Mark this release's failed migrations as rolled back, while its
|
||||
# checkout is still in place (found in the VM test).
|
||||
if declare -F "${p}_resolve_failed_migrations" >/dev/null; then
|
||||
"${p}_resolve_failed_migrations" "$dir" "$user" "$prev" || warn "$p: couldn't mark the failed migration as rolled back; the next deploy will say so."
|
||||
fi
|
||||
set +e
|
||||
(
|
||||
set -e
|
||||
|
||||
Reference in New Issue
Block a user