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.
Error: No changes in database schema were found - cannot generate a
migration. To create a new empty migration use "typeorm migration:create"
commandCommon 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.
npx typeorm migration:generate ./src/migrations/AddOrderStatus \
-d ./src/data-source.tsBuild before generating against compiled output
- If using the JS CLI, run your TypeScript build so the latest entities are compiled.
- Confirm the
entitiespaths in the DataSource resolve to the files you just built. - 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.
npx typeorm migration:create ./src/migrations/AddOrderStatusHow to prevent it
- Keep the DataSource
entitiesglob 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.