mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
Support self-referencing FKs in create (#537)
This commit is contained in:
parent
9662d4ce26
commit
39ef137e67
2 changed files with 30 additions and 0 deletions
|
|
@ -813,6 +813,8 @@ class Database:
|
|||
pk = hash_id
|
||||
# Soundness check foreign_keys point to existing tables
|
||||
for fk in foreign_keys:
|
||||
if fk.other_table == name and columns.get(fk.other_column):
|
||||
continue
|
||||
if not any(
|
||||
c for c in self[fk.other_table].columns if c.name == fk.other_column
|
||||
):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue