diff --git a/export-laravel-5-migrations.py b/export-laravel-5-migrations.py index 4946aac..12abfb9 100644 --- a/export-laravel-5-migrations.py +++ b/export-laravel-5-migrations.py @@ -146,7 +146,7 @@ def create_tree(table_schema): table_references = [] for key in tbl.foreignKeys: - if key.name != '' and tbl.name != key.referencedColumns[0].owner.name: + if key.name != '' and tbl.name != key.referencedColumns[0].owner.name and hasattr(key, 'referencedColumns'): table_references.append(key.referencedColumns[0].owner.name) tree[tbl.name] = table_references