INSERT/UPDATE Strict Models Enhancements
Using strict models is a good way to normalise data on it's way to the database. Currently it is possible to pass a Model\Strict
object to DBI and it will extract the data into a field object to send to the driver, all automatically.
What it doesn't do automatically, is to do with fields that have a default value. Currently for these fields I would set dbi: false
so that DBI does not send them. This is fine for an INSERT if I want the database server to create the value. But with an update, we might want to update a value.
What I propose is, if possible, we can do away with dbi: false
in the strict model field definition and get INSERT to check the column metadata for any field values that are NULL. This should allow the INSERT to succeed because the actual SQL field will not include the NULL values, but at the same time allow UPDATES to succeed because we are no longer disabling DBI on these fields.