Apparently SQLite3 supports Foreign Keys for some time now, so we could look into using them. This would allow us to get rid of some of the manual clean ups that we have to do in order to accommodate FK-less SQLite.
Description
Description
Comment Actions
Currently not having FKs means we don't even have indexes on the FK columns, which makes queries extremely slow.
The main problem is that SQLite does not support adding/removing FKs through ALTER TABLE, the only solution is to ALTER TABLE foo RENAME TO foo_old, CREATE TABLE foo ... with FKs and INSERT INTO foo SELECT * FROM foo_old, which is extremely expensive. But we don't change FKs very often and I doubt there are many people who use SQLite with large setups (maybe exactly because it's too slow), so the slow upgrade should not affect too many users. If it turns out that we are fast enough with proper FKs, I'd consider switching from MySQL to SQLite as default.