I need to disable or circumvent `NOT NULL` constraints when initially inserting data, and sadly modifying the schema or providing the values is not an option. SQLite has [`PRAGMA foreign_keys = 0;`](https://www.sqlite.org/pragma.html#pragma_foreign_keys) & [`PRAGMA ignore_check_constraints = 1;`](https://www.sqlite.org/pragma.html#pragma_ignore_check_constraints) but neither (understandably) disable the `NOT NULL` constraints. I'm replicating the schema and data from a gargantuan SQL Server database into a SQLite database. The SQLite schema is created using the same migrations as the source database, then [NHibernate](https://nhibernate.info/) (ORM) is used to copy all entities in two passes; first all root entities (non joining many to many tables) and their non-relational properties (strings, int, binary columns etc), then in the second pass the relationships between the entities are stitched back together. Its in the fist pass that an exception is thrown: > System.Data.SQLite.SQLiteException: 'constraint failed NOT NULL constraint failed: Trainer.Home' This happens as expected when attempting to insert entities with `NOT NULL` foreign key constraints that I'd like to avoid. *Why can't I just modify the schema?* I *can*, but given that hundreds of tables are involved, finding an alternative approach would be preferable. *Why can't I just insert the data in order?* Due to circular references between entities it would be preferable to follow a more simplistic procedure rather than a graph-traversal-*n*-pass one. I've [asked this question offsite](https://stackoverflow.com/q/69126537/3076944) but I probably should have asked here first.