mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-13 12:04:09 +02:00
Support self-referencing FKs in create
This commit is contained in:
parent
c0251cc927
commit
a75abeb61b
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