Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate migrations are executed. #4701

Closed
jurasan opened this issue Sep 6, 2019 · 0 comments
Closed

Duplicate migrations are executed. #4701

jurasan opened this issue Sep 6, 2019 · 0 comments

Comments

@jurasan
Copy link
Contributor

jurasan commented Sep 6, 2019

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Create two migrations in 2 files, but with the same class name.

There are two scenarios:

  1. You run one migration and then another in 2 steps. Then the second migration is skipped, because its class name is already present in the migrations table.
  2. You run both migrations in one step. This time both migrations are executed

Thus we have different behavior. This creates a problem when you make an error copy-pasting migrations and not changing class name, and the first migration is already applied. When you run tests that run all migrations at once all the migrations will be executed despite duplicate class name. When you apply it on live database, the second migration will be skipped.

jurasan pushed a commit to jurasan/typeorm that referenced this issue Sep 6, 2019
Make the behavior the same whether duplicated migrations applied in one step or not.

Closes: typeorm#4701
@jurasan jurasan mentioned this issue Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants