8000 SQLite strict tables · Issue #204 · go-gorm/sqlite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SQLite strict tables #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
asbjornu opened this issue May 3, 2025 · 0 comments
Open

SQLite strict tables #204

asbjornu opened this issue May 3, 2025 · 0 comments
Assignees

Comments

@asbjornu
Copy link
asbjornu commented May 3, 2025

Describe the feature

With strict tables, SQLite can enforce data type integrity that is not enforced otherwise. Without strict tables, the following works in SQLite:

CREATE TABLE user(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?

Motivation

Strict tables enable data integrity checks that are disabled by default.

Sorry for cross-posting this to go-gorm/gorm#7443, but I'm unsure whether this is a feature that belongs to Gorm or the SQLite driver/dialector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0