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
Add new transaction mode to wrap each migration in transaction #4629
Conversation
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.
Wow fantastic. Nice work @nlenepveu !
Looks good |
@pleerock there's any due date for merging this PR? 😄 |
👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏 |
🎉 WOOOP!!! 🎉 |
@pleerock There's a breaking change here. |
I don't understand why it's not possible to use transaction for all in your exemple. The connection between your two migrations is not the same ? |
@obedm503 we might miss breaking changes easily. Please make sure to subscribe to TypeORM issues and pull requests and join others for PR reviews and left your feedback before they go into release version. |
@obedm503 Strictly speaking, I'm not sure we can talk about a breaking change here. |
@nlenepveu the function signature was This was not really an issue for me. Typescript type-checking helped me catch it. I was just commenting for documentation purposes. |
@obedm503 Indeed, you’re right. I missed that point. |
@brunoMaurice Indeed, this issue happens when you do not use the same connection. It appears that the |
@nlenepveu Thanks for the answer. Did you think, it can be an enhancement to use the same |
It is the extension of pull request typeorm#4629 which allows applying same transaction options when running transactions in automatic mode
It is the extension of pull request typeorm#4629 which allows applying same transaction options when running transactions in automatic mode
It is the extension of pull request typeorm#4629 which allows applying same transaction options when running transactions in automatic mode
* feat: add migrations transaction option to connection options It is the extension of pull request #4629 which allows applying same transaction options when running transactions in automatic mode * feat: add migrations transaction option to connection options It is the extension of pull request #4629 which allows applying same transaction options when running transactions in automatic mode * feat: add migrations transaction option to connection options It is the extension of pull request #4629 which allows applying same transaction options when running transactions in automatic mode
@brunoMaurice definitely! It should be a better option to keep a single transaction between each migration. |
Hello people!
This work is based on the awesome work done by @garbles in #3208.
Addresses #2693
Presentation by @garbles from the original pull request:
For example, if you have the following two migrations, you can never run them in a row.
The INSERT in the second migration will fail as the schema does not exist at that point. The first migration should be committed before enabling the second one to access the newly created table.
Changes to the -t flag to accept:
all
(run all migrations in a single transaction),each
(run each migration in a separate transaction),none
(run all migrations without transactions) orfalse
(same as none).TODO:
@pleerock I addressed some of the comments you left some months ago. It would be great if you can have a look at this work!