Fix on delete and on update for SQLite foreign keys.