You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is :account module with Account.sq table. Then there is :customer module with Customer.sq table. Customer has a "foreign key" referencing account. (customer is child of account).
Unfortunately due to how build is shaped (monorepo with multiple apps) :customer cannot depend on :account & therefore have a real FOREIGN KEY.
What I do is at app (:app module) I fake the foreign key via triggers (delete from customer when account is deleted + integrity check but that's besides the point now).
CREATE TRIGGER IF NOT EXISTS account_fake_foreign_key_cascade_delete
BEFORE DELETE ON account
FOR EACH ROW BEGIN
DELETE FROM user WHERE accountId = old.id;
END;
It works, i.e. when I accountQueries.deleteAccount() and then query customerQueries.customer().executeAsOneOrNull() synchronously it returns null - as expected.
However when I observe customerDao.customer().asFlow().mapToOneOrNull(), it never emits. (the nulll)
(Note that when observing accountQueries.account... it does emit the nulls).
What I think is happening is that the trigger from :app doesn't participate in the notifyQuery codegen.
I think this used to work with 1.x
Stacktrace
No response
The text was updated successfully, but these errors were encountered:
SQLDelight Version
2.0.2
Application Operating System
Android
Describe the Bug
Hi, I have a multimodule setup.
There is
:account
module withAccount.sq
table. Then there is:customer
module withCustomer.sq
table. Customer has a "foreign key" referencing account. (customer is child of account).Unfortunately due to how build is shaped (monorepo with multiple apps)
:customer
cannot depend on:account
& therefore have a realFOREIGN KEY
.What I do is at app (
:app
module) I fake the foreign key via triggers (delete from customer when account is deleted + integrity check but that's besides the point now).It works, i.e. when I
accountQueries.deleteAccount()
and then querycustomerQueries.customer().executeAsOneOrNull()
synchronously it returns null - as expected.However when I observe
customerDao.customer().asFlow().mapToOneOrNull()
, it never emits. (the nulll)(Note that when observing
accountQueries.account...
it does emit the nulls).What I think is happening is that the trigger from
:app
doesn't participate in thenotifyQuery
codegen.I think this used to work with 1.x
Stacktrace
No response
The text was updated successfully, but these errors were encountered: