| name | db-migration |
| description | Make a database schema change — new Sequelize migration plus model, types, and associations, with up/down round-trip verification. |
Database Schema Change
Change to make: $ARGUMENTS
- Generate a new migration (NEVER edit a committed one — a hook blocks it):
npx sequelize-cli migration:generate --name <snake_case_name> --config packages/shared/config/database.js
- Edit the generated file in
packages/shared/migrations/. Implement both up() and a working down().
- Update, as one unit: the model in
packages/shared/src/database/index.ts, the TypeScript types/interfaces, and associations in initializeModels() if relationships change.
- Follow conventions: snake_case columns, UUID
id PK, created_at/updated_at, deleted_at for paranoid models.
- Verify the round-trip:
npm run migrate → npm run migrate:status → npm run migrate:undo → npm run migrate.
- Verify types and tests scoped:
npm run type-check -w @silver-cross/shared and npm run test -w @silver-cross/shared.
- Show the migration status output and passing tests as evidence.