Skip to content

Commit 8fe0b1b

Browse files
authored
🐛 use more precise foreign key constraints
1 parent 29ceb9f commit 8fe0b1b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mysql_to_sqlite3/transporter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,10 @@ def _build_create_table_sql(self, table_name: str) -> str:
448448
FROM information_schema.TABLE_CONSTRAINTS AS i
449449
{JOIN} information_schema.KEY_COLUMN_USAGE AS k
450450
ON i.CONSTRAINT_NAME = k.CONSTRAINT_NAME
451+
AND i.TABLE_NAME = k.TABLE_NAME
451452
{JOIN} information_schema.REFERENTIAL_CONSTRAINTS AS c
452453
ON c.CONSTRAINT_NAME = i.CONSTRAINT_NAME
454+
AND c.TABLE_NAME = i.TABLE_NAME
453455
WHERE i.TABLE_SCHEMA = %s
454456
AND i.TABLE_NAME = %s
455457
AND i.CONSTRAINT_TYPE = %s

0 commit comments

Comments
 (0)