question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some schema changes not detected when generating migration

See original GitHub issue

Issue 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:

  1. Clone the above repository.
  2. Run migrations to initialise the database (there’s a utility script for that: npm run migrate-clean).
  3. Notice the additional bar field in the model (it was added after the initial migration had been generated).
  4. Run npx typeorm migration:generate -n second to generate the migration for the additional bar 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:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
andrei9669commented, Jun 16, 2021

just encountered probably the same issue on Postgres. I add a column to an existing entity and migration isn’t detecting changes.

3reactions
imnotjamescommented, Aug 24, 2021

This should be fixed in the next release. This can be confirmed in the latest dev build - 0.2.38-dev.22676a0

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - typeORM No changes in database schema were found
I've seen this error, and if I'm not mistaken it's because I was trying to create a bank that had already been created....
Read more >
Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >
Schema migration - Wikipedia
A schema migration is performed on a database whenever it is necessary to update or revert that database's schema to some newer or...
Read more >
Versioned Migrations Management and Migration Directory ...
If the code review process does not detect this, the migration file ... Attempting to generate new migration files for a schema change...
Read more >
Flyway by Redgate • Database Migrations Made Easy.
Unlike SQL migrations, Java migrations by default do not have a checksum and therefore do not participate in the change detection of Flyway's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found