Set foreign_key on before disabling auto-commit of transactions. The
foreign_key pragma seems to be ignored the other way around.
Why does my delete trigger not work?