SQLite Forum

Method to temporarily disable Not Null constraint?
> Option A: remove the constraints

> Option B: make a table which is a copy of the entity table, but lacks the constraints. Load your data into that. Once the data is all there (which I think means there will be no NULLs left) copy that table to the real table using the INSERT … SELECT command which is optimized for speed. Then DELETE FROM your temporary table.

If you're aware of a programmatic method to do this, i.e. magic `CLONE TABLE A TO B WITHOUT NOT NULL`, rather than manually modifying 500+ migration scripts that generate SQL from C# I think I'll just have to pull my finger out and calculate the correct insertion order.

> If two tables have the same definition, or your table names include numbers or dates, it's probably a sign that they should be the same table, with one extra column.

If only this were so 😢, It's a large (330 tables) relativity well designed schema that happens to map to a complex domain.