-
Notifications
You must be signed in to change notification settings - Fork 15
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
Throw an exception to rollback transaction if SQL migration fails #117
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cham11ng
requested review from
kabirbaidhya,
mesaugat,
aanchal-adk and
samirsilwal
March 23, 2021 14:17
samirsilwal
approved these changes
Mar 23, 2021
cham11ng
force-pushed
the
fix-transaction-issue
branch
from
March 23, 2021 14:25
ddf98f0
to
fb0c762
Compare
aanchal-adk
approved these changes
Mar 24, 2021
mesaugat
reviewed
Mar 24, 2021
cham11ng
changed the title
Throw an exception to rollback transaction if SQL migration fails
Explicitly rollback transaction if SQL migration fails
Mar 24, 2021
cham11ng
force-pushed
the
fix-transaction-issue
branch
from
March 24, 2021 10:44
3acb763
to
01bd804
Compare
cham11ng
changed the title
Explicitly rollback transaction if SQL migration fails
[Do-Not-Merge] Explicitly rollback transaction if SQL migration fails
Mar 24, 2021
cham11ng
changed the title
[Do-Not-Merge] Explicitly rollback transaction if SQL migration fails
Throw an exception to rollback transaction if SQL migration fails
Mar 24, 2021
cham11ng
force-pushed
the
fix-transaction-issue
branch
from
March 24, 2021 12:48
01bd804
to
9f52d7b
Compare
cham11ng
force-pushed
the
fix-transaction-issue
branch
from
March 25, 2021 04:55
1978596
to
15a8aae
Compare
samirsilwal
approved these changes
Mar 25, 2021
mesaugat
reviewed
Mar 25, 2021
mesaugat
reviewed
Mar 25, 2021
@@ -25,7 +25,11 @@ export async function runSequentially<T>(promisers: Promiser<T>[]): Promise<T[]> | |||
|
|||
result.push(value); | |||
} catch (err) { | |||
throw err; | |||
if (!err.result) { |
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.
Still gimmicky. Does the job for now though.
mesaugat
approved these changes
Mar 25, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
db.connection.transaction(async trx => { }
didn't rollback the transaction because no exception was thrown in SQL migration process. In case of migration and rollbacktrx.migrate
andtrx.rollback
transaction rollback is handled internally.I've to remove the log from
getMigrationName
because it called more than a time which pollutes the console for a large number of migration files.