Migration Until Applied
FeaturedOn demandAbout Migration Until Applied
This loop works toward all database migrations applying cleanly. Each round runs npx prisma migrate dev, then checks the outcome with npx prisma migrate status. If failures remain, the agent fixes them based on the output and tries again, for up to 6 rounds.
Key features
- 01Manual trigger, started when the user decides
- 02Capped at 6 rounds to avoid endless retries
- 03Uses npx prisma migrate status as the check command
- 04Supports Cursor
Use cases
- 01Local migrations fail after pulling new code
- 02Confirming a schema change applies in full
- 03Investigating a migration stuck in a failed state
- Goal
- All database migrations apply cleanly, and npx prisma migrate status reports no problems.
- Exit when
- Stop when npx prisma migrate status shows no pending failures, or after the 6-round limit is reached.
- Between iterations run
- npx prisma migrate status
Launch prompt
Paste into Cursor. The agent repeats the steps below until the exit condition is met.
Start the "Migration Until Applied" loop. Goal: All database migrations apply cleanly, and npx prisma migrate status reports no problems. Max iterations: 6. Step 1: Run migrations — Execute npx prisma migrate dev to apply migrations that have not yet run. If it errors, note the message and adjust the schema or migration files accordingly. `npx prisma migrate dev` Step 2: Verify status — Execute npx prisma migrate status to see whether any migrations are still pending or failed. If none are, the loop ends; otherwise the result carries into the next round. `npx prisma migrate status` Between iterations run: `npx prisma migrate status` Exit when: Stop when npx prisma migrate status shows no pending failures, or after the 6-round limit is reached.
Steps
Each round runs in order; if the exit condition isn’t met, another round starts, up to 6.
Execute npx prisma migrate dev to apply migrations that have not yet run. If it errors, note the message and adjust the schema or migration files accordingly.
npx prisma migrate devExecute npx prisma migrate status to see whether any migrations are still pending or failed. If none are, the loop ends; otherwise the result carries into the next round.
npx prisma migrate statusSupported agents
Coding agents that can run this loop directly.