-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Suggestion
I'm running into issues with Loopback 4's migrateSchema() where it doesn't create tables in a predictable order. The docs indicate you can specify the order tables are created for Postgres: https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.html
In my testing both automigrate() & autoupdate() use async.each which runs queries in parallel. I believe these should be rewritten to use async.eachSeries.
https://github.com/strongloop/loopback-connector/blob/master/lib/sql.js#L78
https://github.com/strongloop/loopback-connector/blob/master/lib/sql.js#L1607
Use Cases
Run table migrations in predictable order to eliminate missing relationship errors like relation "public.relationalTableName" does not exist. I believe this could be as simple as rewriting async.each to be async.eachSeries.
I'm happy to submit a PR if the maintainers thought this was an acceptable solution.
Acceptance criteria
TBD - will be filled by the team.