-
Notifications
You must be signed in to change notification settings - Fork 100
fix: run migrations in series #170
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
Conversation
dhmlau
left a comment
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.
@klassicd, thanks for your PR. Your changes LGTM. I'd like to get at least one more review before landing. Thanks.
|
@slnode test please |
montera82
left a comment
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.
LGTM
jannyHou
left a comment
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.
@klassicd Thank you for the contribution, looks reasonable to me. I left a minor comment for the test.
|
|
||
| it('automigrate reports errors for models not attached', function(done) { | ||
| ds.automigrate(['m1', 'm2'], function(err) { | ||
| ds.automigrate(['m1', 'm3'], function(err) { |
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.
any reason change m2 to m3?
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.
Previously there was only a single table m1 attached and m2 was un-attached. The new test (line #55) expects two tables created in a series. So I refactored two tables m1 and m2 to be attached by default, and here to look for an un-attached table m3.
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.
Thank you for the explanation, fair enough.
jannyHou
left a comment
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.
Thank you @klassicd approved. I can help you rebase the PR and will double check the downstream failures.
|
Yes @jannyHou that would help, thank you. |
|
@slnode test please |
|
@klassicd, thanks for your contribution. Your PR has landed! |
Fixes #168
Replaces
async.eachwithasync.eachSeriesinautomigrate()andautoudate()so migrations are run in a series instead of in parallel. This enforces the model order so foreign key constructs with Postgres are possible.Previously it was impossible to enforce order in Loopback 4 using the
modelsoption tomigrateSchema({models: ['m1', 'm2']})as documented here https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.htmlChecklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machine