Support STRICT TABLE in SQLite #2435
Replies: 8 comments 6 replies
-
Supporting |
Beta Was this translation helpful? Give feedback.
-
Is there a workaround for adding |
Beta Was this translation helpful? Give feedback.
-
Adding CREATE TABLE `users` (
`id` bigint primary key auto_increment,
`full_name` varchar(256)
-);
+) STRICT; |
Beta Was this translation helpful? Give feedback.
-
Please implement this, it's very much needed |
Beta Was this translation helpful? Give feedback.
-
By default, SQLite doesn't care too much about column types. While Drizzle, being a TypeScript library, cares very much about strict types. So this combination feels like a semantic mismatch. For this reason, I'd argue that tables should be created strict by default, maybe with an option for The suggested workaround by @moritzruth is not great because this manual step can be forgotten. Since it's not possible to make a non-strict table strict via an |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
When this Issue was moved/copied to Discussion, the issue got closed and the task in the roadmap was marked as Done. Is this feature already implemented and can be activated in the tables schema (meaning that would work with |
Beta Was this translation helpful? Give feedback.
-
I can try to add this as an option for a PR. I started working through the code, but there is an abstraction layer that won't work super well for adding STRICT mode as an option. @pekeler, I agree. It should be on by default for the reasons you stated so well. Supporting It would catch a lot of bugs, too. I just started playing with Drizzle, and I've already found a few bugs. I just submitted this PR: #2970
Drizzle is also generating integer bool types wrong: CREATE TABLE IF NOT EXISTS bool_test (
bool_test integer DEFAULT false NOT NULL
);
Adding |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions