sqlite-database-integration
sqlite-database-integration copied to clipboard
Prevent SQLite from inserting NULL values into NOT NULL columns
In https://github.com/WordPress/sqlite-database-integration/pull/94 we added support for allowing columns to be updated to null even if they have NOT NULL in the column definition and don't have a DEFAULT value.
This was done to match how MySQL works without the STRICT_TRANS_TABLES mode.
An unwanted consequence is that we now allow the insertion of NULL to NOT NULL columns which isn't how MySQL works without STRICT_TRANS_TABLES mode.
To fix this we need to prevent SQLite from inserting NULL values into NOT NULL columns, but still allow updates.
Some options I explored earlier were triggers or modifying the update query to ensure a default value.