Added trigger code to enforce not updating to invalid model type in Sqlite3 to match the behaviour in Postgresql. Added spec for the case.