drizzle-orm
drizzle-orm copied to clipboard
[FEATURE]: Add check support in drizzle-kit
Describe what you want
This issue is a part of https://github.com/drizzle-team/drizzle-orm/issues/229
+1 to CHECK support.
+1 to Check support.
checks would be great, i need it for my code
+1 to CHECK support
+1
any update for this feature? Check constraint is one of the core feature of any RDBMS. It should be implemented with higher priority.
Is there a workaround for this with Drizzle's sql operator ?
Ditto what @efkann said. Is there a workaround with the sql method?
@efkann @arxpoetica I found a workaround when defining a default. It may not work for all use cases but it's working for me.
schema:
export const exampleTable = schema.table('example_table', {
// ... other columns not included
status: text('status', {
enum: ['pending', 'active', 'suspended', 'archived'],
})
.notNull()
// HACK: Drizzle does not yet support check constraints as of writing this
.default(
sql`'pending' CHECK (status IN ('pending', 'active', 'suspended', 'archived'))`,
),
});
generates:
CREATE TABLE IF NOT EXISTS "my_schema"."example_table" (
"status" text DEFAULT 'pending' CHECK (status IN ('pending', 'active', 'suspended', 'archived')) NOT NULL
);
💎 $20 bounty created by @rvaidun 👉 To claim this bounty, submit your pull request on Algora 📝 Before proceeding, please make sure you can receive payouts in your country 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🙏 Thank you for contributing to drizzle-team/drizzle-orm!
/attempt #880
@rvaidun, @AndriiSherman before giving my effort to it, can you please let me know if you can assign it to me?
+1000 for this
any updates? 👀
+1 +1 +1 +1
Is there any update on this?
+2392394
+2024
+10086
+2028812
+111
+9999999999
If one more person posts a +1 instead of clicking the 👍 reaction I will cry
+0.1
+1
+1
Available in [email protected] and [email protected]