3 ms·
Here is the STRICT table type page: https://www.sqlite.org/stricttables.html https://www.sqlite.org/stricttables.html It is fairly straightforward: you just hav
by larkost 2y ago
Here is the STRICT table type page: https://www.sqlite.org/stricttables.html https://www.sqlite.org/stricttables.html
It is fairly straightforward: you just have to add STRICT to your table definition and you have it.
And the FOREIGN KEY support is here: https://www.sqlite.org/foreignkeys.html https://www.sqlite.org/foreignkeys.html
The two requirements are that your build not have it disabled, and that you execute `PRAGMA foreign_keys = ON;` when you open the database (every time you open the database).
- neverartful 2y agoI don't view opt-in as a very good defaults for these.
- ncruces 2y agoThen build with SQLITE_DEFAULT_FOREIGN_KEYS=1 to make it opt-out (and to opt-out you'd need to inject SQL). As for STRICT: if you make your tables STRICT, there's no opt-out. So why is this an issue? Do you want them to break the file format to say "from this version forward, all tables are STRICT"? What does that really buy you? It's an embed database: anyone who can mess with your database and circumvert integrity can also open the file and corrupt it.
- IshKebab 2y ago> What does that really buy you It removes a footgun for new users. That's not an insignificant benefit. Probably not worth the backwards compatibility cost, but it definitely is an issue.
- ncruces 2y agoMy builds of SQLite do enable foreign keys by default. This is easy to do for any project using the amalgamation.