/** * Migration template — copy into a new file via `npm run migrate:create -- `. * * File naming convention: `_.ts` * e.g. `20260526143000_add_finance_kyc_column.ts` * * The runner (`scripts/run-migrations.ts`) imports the default export and * invokes `up()`. After `up()` resolves it records the filename (without * extension) in the `migrations` table so the migration is never re-run on * this environment. * * Guidelines: * - Always wrap multi-statement changes in a single Sequelize transaction. * - Prefer idempotent DDL (`IF NOT EXISTS`, `IF EXISTS`) so accidental * re-runs are safe. * - Never destructively drop columns/tables that hold real production data * unless you have a separate, explicit data-migration step. * - Update the corresponding Sequelize model in `src/database/models/` * in the same PR — migrations are a delta for environments that already * have a populated schema; the model definitions remain the source of * truth for fresh `npm run migrate` builds. */ import type { QueryInterface, Sequelize } from 'sequelize'; export interface MigrationContext { queryInterface: QueryInterface; sequelize: Sequelize; } const migration = { async up({ sequelize }: MigrationContext): Promise { // Example: // await sequelize.query(` // ALTER TABLE "applications" // ADD COLUMN IF NOT EXISTS "kycReviewedAt" TIMESTAMPTZ NULL; // `); throw new Error('Migration template — implement up() before running.'); } }; export default migration;