Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 844 Bytes

File metadata and controls

31 lines (21 loc) · 844 Bytes

Database Migrations

Schema changes belong in migration files under src/db/migrations/. Create them with:

npm run db:migration:create --name=add_embedding_index

In local development, run pending migrations manually with:

npm run db:migration:up

Production startup applies pending migrations automatically. Tests auto-run migrations from initDb() so each test DB starts with the full schema.

Use db:migration:fresh only for local development or tests. It drops app tables, then runs all migrations so the DB is immediately usable:

npm run db:migration:fresh

Never run db:migration:fresh in production.

Built-in model catalog rows live in migrations. Add, retire, or correct default models with a new forward migration.

Use db:migration:status to inspect which migration files have already run.