Some schema changes not detected when generating migration
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x] 0.2.22
(or put your version here)
Steps to reproduce or a small repository showing the problem:
Repo to reproduce: https://github.com/jalooc/typeorm-migration-generator-bug-repro
What happens: The linked repo is a minimal reproduction environment for the bug we’re having in a bigger project. What happens, is sometimes the migration generator doesn’t detect changes between database schema and entities. Note that it happens just sometimes - most of the time it works, so it’s rather not a problem of configuration. Sometimes doesn’t mean totally random in time, but rather random depending on particular change - if it doesn’t work for some change in entity, it won’t work no matter how many times I try; but it may work for a different change.
Steps to reproduce:
- Clone the above repository.
- Run migrations to initialise the database (there’s a utility script for that:
npm run migrate-clean
). - Notice the additional
bar
field in the model (it was added after the initial migration had been generated). - Run
npx typeorm migration:generate -n second
to generate the migration for the additionalbar
field. This yields:
No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command
but should generate a table altering script instead.
Note: you can also reproduce the steps checking out commits one by one.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:20 (3 by maintainers)
Top GitHub Comments
just encountered probably the same issue on Postgres. I add a column to an existing entity and migration isn’t detecting changes.
This should be fixed in the next release. This can be confirmed in the latest dev build -
0.2.38-dev.22676a0