TypeORM "No migrations are pending" in CI
TypeORM compares the migrations it can load against the migrations table and applies the difference. "No migrations are pending" means it sees nothing to run, usually because it never loaded your migration files in the CI environment.
What this error means
typeorm migration:run prints "No migrations are pending" and exits 0, even though you added a migration that has not been applied to this database.
No migrations are pendingCommon causes
The migrations glob matches compiled paths that do not exist
The DataSource migrations glob points at dist/**/*.js, but CI runs from TypeScript without building, so no migration files are loaded.
The migration is already recorded as run
The migrations table already has a row for it (for example from a seeded database), so TypeORM correctly considers it applied.
How to fix it
Match the migrations glob to what CI runs
- If CI runs TypeScript directly, point the glob at the
.tssources and run with ts-node. - If CI builds first, point it at the compiled
.jsoutput and ensure the build ran. - Re-run
migration:runand confirm the file is now detected.
export const AppDataSource = new DataSource({
// running TS directly in CI:
migrations: ['src/migrations/*.ts'],
});Run against a clean database
Start CI migrations from an empty database so the migrations table does not already contain the rows you expect to apply.
How to prevent it
- Keep the migrations glob aligned with whether CI runs TS or compiled JS.
- Run migrations against a fresh database in CI.
- Build before running migrations when the glob targets dist.