Backend

Database Migration Template

A template for planning and executing database schema changes including new tables, column modifications, data migrations, index optimization, and rollback procedures.

Template Preview

Copy and use in your project

Database: [Add/Modify/Remove] [table/column] for [feature]

As a developer, I want the database schema updated to support [feature] so that the application can store and query the new data efficiently without affecting existing functionality.

choreHIGH5 pts

Description

Plan and execute a database schema change to support [feature/requirement]. This includes modifying the Prisma schema, generating and reviewing the migration, handling existing data, and verifying the change in staging before production. **Schema Changes:** - Add/modify/remove [table/column] - Add/update indexes for query performance - Update relations if applicable **Data Migration:** - Backfill strategy for existing rows - Default values for new non-nullable columns - Data transformation logic if restructuring **Rollback Plan:** - Document the reverse migration steps - Ensure the rollback doesn't cause data loss - Test rollback in staging environment

Acceptance Criteria

Given the Prisma schema has been updated with the new changes

When I run `npx prisma db push` against the development database

Then the migration applies successfully without errors and the schema matches the expected state

Given there is existing data in the affected tables

When the migration runs

Then existing data is preserved and new columns have appropriate default values or are backfilled correctly

Given the migration has been applied

When the application runs its queries against the updated schema

Then all existing features continue to work correctly and new queries for the feature return expected results

Given the migration has been applied to staging

When I run the full test suite

Then all tests pass and no regressions are detected in related functionality

Import directly into Codepylot

Skip the copy-paste. Codepylot has built-in templates you can use with one click, plus AI that generates even richer stories from your ideas.

Try Codepylot Free

Other Templates

Ready to build your AI agent workforce?

Describe what you want. Your agents write the code. You stay in control.