In SQLDelight, what is the best way to use PRAGMA ...
# squarelibraries
y
In SQLDelight, what is the best way to use PRAGMA in multiplatform project? Extending
SqlDrive.Schema
and manually execute PRAGMA statement in
create
function? I found this issue(https://github.com/square/sqldelight/issues/1241 ), but it does not cover multiplatform.
seems like this is not working on iOS 🤔
I'm trying to enable foreign_keys.
Copy code
driver.execute(null, "PRAGMA foreign_keys=1;", 0)
Executing above statement in
Schema#create
works on Android, but not on iOS
d
What version of sqlite is on iOS?
y
sqliter 0.6.2 sqldelight 1.1.3
d
Sqlite itself, not the wrappers.
y
@Dominaezzz looks like it's 3.24.0 I cannot find it from SQLiter repo, but
select sqlite_version() AS sqliter_version
says so
d
How does it fall btw? What's the output?
y
actually, it does not fail because foreign_keys is not working
https://gist.github.com/yshrsmz/9af83a5d2d72f23fd5007a8ab3a8dd57 say I have these two tables: linkProduct and linkedProduct.
linkedProduct has foreign key constraint to linkProduct
and in a unit test I try to insert linkedProduct without inserting linkProduct
on Android it fails with SQLiteConstraintException, but on iOS it does not fail and record is inserted to linkedProduct, even though the constraint is not satisfied
looks like FK is ignored if if I wrap insert statement in transaction @alec
I'm preparing repro
233 Views