Skip to content

Commit d429a85

Browse files
authored
Force alphabetical order on tables list
Sometimes the schema's table list isn't on the order that the code expects - sorted(migrations) - and this messes the migration order, trying to create foreigns keys for tables not created yet. Forcing the order solved for me.
1 parent 51b590a commit d429a85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

export-laravel-5-migrations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def export_schema(out, schema, is_main_schema):
3434
migration_tables = []
3535
global migrations
3636

37-
for tbl in schema.tables:
37+
for tbl in sorted(schema.tables, key=lambda table: table.name):
3838
migration_tables.append(tbl.name)
3939
migrations[tbl.name] = []
4040
migrations[tbl.name].append('<?php\n')

0 commit comments

Comments
 (0)