You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With strict tables, SQLite can enforce data type integrity that is not enforced otherwise. Without strict tables, the following works in SQLite:
CREATETABLEuser(id INTEGER);
INSERT into user VALUES ("YOLO!"); --- This works!
Is it possible to enable strict tables in Gorm, somehow? I've tried to do db.Set("gorm:table_options", "STRICT"), but it seemingly has no effect. To inspect whether the table has been created strict, I run the following query:
select*from pragma_table_list
And if the strict column is set to 1, it's a strict table. So far, I've not been successful in having Gorm create strict tables in SQLite. Do I need to create a custom SQLite Dialector for this?
Sorry for cross-posting this to go-gorm/sqlite#204, but I'm unsure whether this is a feature that belongs to Gorm or the SQLite driver/dialector.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
With strict tables, SQLite can enforce data type integrity that is not enforced otherwise. Without strict tables, the following works in SQLite:
Is it possible to enable strict tables in Gorm, somehow? I've tried to do
db.Set("gorm:table_options", "STRICT")
, but it seemingly has no effect. To inspect whether the table has been created strict, I run the following query:And if the
strict
column is set to1
, it's a strict table. So far, I've not been successful in having Gorm create strict tables in SQLite. Do I need to create a custom SQLiteDialector
for this?Sorry for cross-posting this to go-gorm/sqlite#204, but I'm unsure whether this is a feature that belongs to Gorm or the SQLite driver/dialector.
Beta Was this translation helpful? Give feedback.
All reactions