_See https://github.com/strongloop/loopback-next/issues/1718 for background context._
As a user building an LB4 application with HasMany BelongsTo or HasOne relation, I want lb4 automigrate to define SQL constraints (foreign key, unique) in such way that referential integrity will be correctly enforced by the database.
Ensure the new tests are executed as part of connector test suite and that they pass on our CI for the following connectors
Depending on how much work the following connectors will require, either improve them as part of this story or create follow-up stories:
We'll do mysql for this story and create follow-up stories for the remaining ones, as it's quite large.
@bajtos @nabdelgadir I am able to create foreign key constraints by adding settings.foreignKeys configuration to a model. but the problem is loopback attempts to create foreign keys along with the table creation. A foreign key could reference a column of a table that is yet to be created. In this case, loopback migration script fails. Foreign key creation must be delayed until tables are all created. Here's an example of the error. That happened because the users table had not been created yet.

@authenticode You may be interested in https://github.com/strongloop/loopback-connector/pull/170 which forces migrations to be run in a series so you can effectively use the models option to migrateShema as mentioned here https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.html#database-migration-using-npm-run-migrate-command
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.
Most helpful comment
We'll do
mysqlfor this story and create follow-up stories for the remaining ones, as it's quite large.