Would it be possible to make drift_dev not fail with a "Illegal circular reference" when part of the chain uses DEFERRABLE INITIALLY DEFERRED foreign keys?
I tried using a customContraint instead of a check, but I it seems you parse those! Impressive, but problematic for my case :)
To clarify why, the following is valid sqlite and works:
CREATE TABLE contacts (
id INTEGER PRIMARY KEY,
main_uuid BLOB NOT NULL UNIQUE REFERENCES uuid_of_contacts(uuid)
) STRICT;
CREATE TABLE uuid_of_contacts (
contact_id INTEGER NOT NULL REFERENCES contacts(id) DEFERRABLE INITIALLY DEFERRED,
uuid BLOB NOT NULL UNIQUE
) STRICT;
PRAGMA foreign_keys = ON;
begin;
insert into uuid_of_contacts values (1, x'0500');
insert into contacts(uuid) values (x'0500');
commit;
Removing the begin+commit, or either of the insert, or the INITIALLY DEFERRED will have a foreign key violation, but the whole thing is acceptable.
So I guess the circular reference checker would need to ignore all those that are mentioned to be deferrable, which include the initiallyDeferred: true
Would it be possible to make drift_dev not fail with a "Illegal circular reference" when part of the chain uses
DEFERRABLE INITIALLY DEFERREDforeign keys?I tried using a customContraint instead of a check, but I it seems you parse those! Impressive, but problematic for my case :)
To clarify why, the following is valid sqlite and works:
Removing the begin+commit, or either of the insert, or the
INITIALLY DEFERREDwill have a foreign key violation, but the whole thing is acceptable.So I guess the circular reference checker would need to ignore all those that are mentioned to be deferrable, which include the
initiallyDeferred: true