Skip to content
Latchkey

TypeORM "No changes in database schema were found" on generate

TypeORM compared your entities to the database and found no difference, so migration:generate has nothing to emit. Usually the entities were not loaded, the CLI used the wrong data source, or the database already reflects the entity state.

What this error means

typeorm migration:generate exits reporting no changes and writes no file, even though you changed an entity. It is deterministic - the diff the CLI computed is genuinely empty given what it loaded.

typeorm output
Error: No changes in database schema were found - cannot generate a
migration. To create a new empty migration use "typeorm migration:create"
command

Common causes

Entities not picked up by the data source

If the entities glob does not match your compiled/TS files (e.g. pointing at dist when running from src), TypeORM sees no entities to diff and finds no changes.

Wrong DataSource or database targeted

Generating against a database that already has the new schema (or a different database than you think) yields an empty diff.

Migrations not built before generate

Running the JS CLI against stale compiled output means your latest entity edits are not reflected, so no diff appears.

How to fix it

Point the CLI at the correct DataSource and entities

Pass the data source file explicitly and make sure its entities glob matches what you run.

Terminal
npx typeorm migration:generate ./src/migrations/AddOrderStatus \
  -d ./src/data-source.ts

Build before generating against compiled output

  1. If using the JS CLI, run your TypeScript build so the latest entities are compiled.
  2. Confirm the entities paths in the DataSource resolve to the files you just built.
  3. Verify you target a database that does NOT already contain the change.

Use migration:create for a hand-written migration

When you intend to write SQL yourself, create an empty migration instead of relying on the diff.

Terminal
npx typeorm migration:create ./src/migrations/AddOrderStatus

How to prevent it

  • Keep the DataSource entities glob in sync with how you run the CLI (src vs dist).
  • Generate against a database that reflects the previous schema, not the new one.
  • Commit the data source config so CI and local generation behave the same.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →