> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurtcommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Database migrations

Migrations evolve the schema between application releases. The repository `.env.example` identifies migration files under `src/database/migrations/**/*.ts` and the migrations directory as `src/database/migrations`.

## Before running migrations

1. Confirm the application tag/commit and matching migration set.
2. Read every pending migration and identify table locks, data rewrites, index changes, and foreign-key effects.
3. Take and test a database backup.
4. Run against a production-like staging copy.
5. Plan rollback or forward-fix steps; not every migration is safely reversible.

## Execution

Use the migration command configured by the target release's `package.json` and TypeORM configuration. Do not guess a CLI command from another TypeORM major version.

## Production practices

Use a dedicated migration identity, schedule potentially blocking DDL, monitor database load, and verify row counts/constraints after execution. Keep schema synchronization disabled in production unless the project explicitly documents another safe mechanism.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.