Closed Wiejeben closed 7 years ago
The order they get created in is whatever Sequel Pro sets the list of selected tables to, which is likely alphabetically.
The tool is mostly for dumping table structures ... I can't think of any way you could make it smart enough to re-order them to avoid your situation.
Sorry.
Why dont you write all foreign keys to a separate file that runs after all the exports? and then you have a foreign_key migration?
That might work. Feel free to submit a PR! ;)
When generating the migration files it seems to create them in alphabetical order, this creates an issue when for example my "addresses" table (Will be inserted first) has a foreign key to table "cities" (Inserts later)
The following error is throwing when running
php artisan migrate
on a clean database: