-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
fix: disable SQLite FK checks in synchronize / migrations #7922
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
fix: disable SQLite FK checks in synchronize / migrations #7922
Conversation
|
|
So I think this approach won't work but I have a test that should confirm that.. |
018b15d to
7c33825
Compare
52668c2 to
a37a81f
Compare
a37a81f to
5b1698b
Compare
| /** | ||
| * Called before migrations are run. | ||
| */ | ||
| async beforeMigration(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't these methods be defined in AbstractSqliteQueryRunner?
| await connection.close(); | ||
|
|
||
| expect(saves).to.be.equal(7); | ||
| expect(saves).to.be.equal(8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
|
If I understand this correctly, migrations can now go haywire with FKs, but at the same time, they are guaranteed to not have you lose data acidentally because of |
|
FYI for anybody that comes accross this trying to figure out how to use Explanation in case it wasn't intentional: As a result the workaround to do this for 0.2.x is still to run the migrations yourself like this (and not use migrationsRun: true), however this means you can't use the cli for migrations:run or revert. A longer term solution could be to have a |
|
Hello, this might be working well when we execute one specific migration. typeorm/src/migration/MigrationExecutor.ts Lines 334 to 361 in c669f50
Adding here as well beforeMigration and afterMigration would be consistent |
|
@imnotjames Hi 👋🏽 , |
Description of change
this moves the
PRAGMAcalls to where we need them in the sqlite migration generation / synchronizefixes #2576
Pull-Request Checklist
masterbranchnpm run lintpasses with this changenpm run testpasses with this changeFixes #0000