Skip to content

Commit

Permalink
Merge pull request #444 from 0x0aNL/0x0anl-doc-mysql-fk-order
Browse files Browse the repository at this point in the history
fix(docs): Specify table creation order method
  • Loading branch information
dhmlau authored Apr 16, 2021
2 parents c681b2d + 10d5741 commit c5e72db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,14 @@ type, you can:
Foreign key constraints can be defined in the model definition.
**Note**: The order of table creation is important. A referenced table must
exist before creating a foreign key constraint.
exist before creating a foreign key constraint. The order can be specified
using the optional <a href="https://loopback.io/doc/en/lb4/apidocs.repository.schemamigrationoptions.html">`SchemaMigrationOptions`</a> argument of `migrateSchema`:
```
await app.migrateSchema({
models: [ 'Customer', 'Order' ]
});
```
Define your models and the foreign key constraints as follows:
Expand Down

0 comments on commit c5e72db

Please sign in to comment.