Skip to content

Stringhtened migration drift checks across environmtents#781

Open
aboyejirebecca-prog wants to merge 1 commit into
Calebux:mainfrom
aboyejirebecca-prog:feat/657-strengthen-migration-drift-checks
Open

Stringhtened migration drift checks across environmtents#781
aboyejirebecca-prog wants to merge 1 commit into
Calebux:mainfrom
aboyejirebecca-prog:feat/657-strengthen-migration-drift-checks

Conversation

@aboyejirebecca-prog
Copy link
Copy Markdown

Summary

  • Add --env <label> flag to check-migration-drift.js so every check output (console and JSON) is tagged with its environment (local, ci-remote, etc.), making cross-environment comparison unambiguous
  • Fix broken PR comment in migration-drift-check.yml — was reading process.env.STATUS (never set), so always showed "❌ Drift detected!" regardless of result; now captures --json output and renders actual issue list ([duplicate], [conflict], [unapplied_migration], [orphaned_migration]) into the comment body
  • Add verify-local-database CI job to migration-drift-check.yml — spins up a local Supabase stack on every PR, applies all migrations, runs --verify-db --env local, and posts a dedicated PR comment with applied/filesystem counts and any issues found
  • Add drift check step to database.yml — after migrations are applied to the local stack, runs --verify-db --env local --json and fails the job with per-issue output if state diverges from filesystem
  • Add Environment-Aware Output and Conflicting Migration History Detection test suites covering env field in JSON output, local vs ci-remote label distinction, cross-environment count divergence, and orphaned issue timestamps
  • Expand MIGRATION_REMEDIATION.md Case 6 (Cross-Environment Divergence) with CI job references and new --env commands; add Case 7 for CI-remote-only orphaned migrations

Test plan

  • Run node scripts/check-migration-drift.js --json — verify "env": "unknown" appears in output
  • Run node scripts/check-migration-drift.js --env local --json — verify "env": "local" in output
  • Run npm run test:migrations — all existing tests pass, new Environment-Aware Output and Conflicting Migration History Detection suites pass
  • Open a PR that touches supabase/migrations/ — confirm three PR comments appear: 🔍 Migration Drift Check, 🖥️ Local Database Drift Check, 📊 CI Remote Database Drift Check
  • Confirm 🔍 Migration Drift Check comment lists actual [duplicate] / [conflict] items when drift exists, not just pass/fail
  • Confirm database.yml workflow fails with ❌ Local database drift detected: [unapplied_migration] ... when a migration file is present but not applied

Closes

Fixes #657
Backlog: #63

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@aboyejirebecca-prog Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@aboyejirebecca-prog
Copy link
Copy Markdown
Author

Ready for review! All tests pass. Happy to make changes if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] Strengthen migration drift checks across environments

1 participant