flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[CI] Stop masking broken Prisma migrations with db push --accept-data-loss

Open blurbeast opened this issue 2 weeks ago • 4 comments

Overview & Background

Ephemeral environments paper over migration failures with npx prisma db push --accept-data-loss: .github/workflows/pr-preview.yml:87-92 (whose comment admits "the committed 20260221132622_init migration fails on a fresh database") and scripts/deploy-preview.sh:85-90 both fall back to db push. Production (render.yaml:9) runs only prisma migrate deploy with no fallback — so if the comment is true, a fresh production database fails to boot; if stale, the fallback silently masks drift. backend/prisma/migrations/ also contains contradictory duplicates (20260830000000 vs 20260926000000 both adding IndexerDeadLetterEvent, the latter starting with DROP TABLE IF EXISTS ... CASCADE), plus several same-timestamp pairs.


Technical Specification & Architecture

  1. Repair 20260221132622_init (or squash the history) so migrate deploy passes on an empty DB.
  2. Add a CI job that runs prisma migrate deploy against a truly fresh database on every migration change.
  3. Delete the db push --accept-data-loss fallbacks from pr-preview.yml and deploy-preview.sh.
  4. Reconcile the duplicate dead-letter migrations so replaying history never drops data.

Target Files

  • backend/prisma/migrations/
  • .github/workflows/pr-preview.yml
  • scripts/deploy-preview.sh
  • render.yaml

Acceptance Criteria

  • [ ] prisma migrate deploy succeeds on a fresh database with no fallback.
  • [ ] CI verifies fresh-DB migration replay.
  • [ ] No --accept-data-loss in any workflow or script.
  • [ ] Migration history has no contradictory duplicate entries.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@Bashibawa has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

Hi Maintainer, I would like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Bashibawa to this issue.

Bashibawa avatar Nov 21 '26 01:11 Bashibawa

@Ayomikun2005 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

allow me do thus

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Ayomikun2005 to this issue.

Ayomikun2005 avatar Nov 21 '26 07:11 Ayomikun2005

Congratulations, @Ayomikun2005! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @Ayomikun2005: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 07:11 drips-wave[bot]

This issue has been completed by @Ayomikun2005 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @Ayomikun2005: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 24 '26 17:11 drips-wave[bot]