Skip to content
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

[FEATURE]: Add check support in drizzle-kit #880

Closed
AndriiSherman opened this issue Jul 11, 2023 · 28 comments
Closed

[FEATURE]: Add check support in drizzle-kit #880

AndriiSherman opened this issue Jul 11, 2023 · 28 comments
Assignees
Labels
drizzle/kit enhancement New feature or request

Comments

@AndriiSherman
Copy link
Member

Describe what you want

This issue is a part of #229

@AndriiSherman AndriiSherman added the enhancement New feature or request label Jul 11, 2023
@AndriiSherman AndriiSherman self-assigned this Jul 12, 2023
@SebastianGarces
Copy link

+1 to CHECK support.

@dcchrispen
Copy link

+1 to Check support.

@nairol203
Copy link

checks would be great, i need it for my code

@harrispap03
Copy link

+1 to CHECK support

@itsyoboieltr
Copy link

+1

@md-redwan-hossain
Copy link

any update for this feature? Check constraint is one of the core feature of any RDBMS. It should be implemented with higher priority.

@efkann
Copy link

efkann commented Oct 16, 2023

Is there a workaround for this with Drizzle's sql operator ?

@arxpoetica
Copy link

Ditto what @efkann said. Is there a workaround with the sql method?

@austincm
Copy link

@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
);

@algora-pbc
Copy link

💎 $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!

@nermalcat69
Copy link

/attempt #880

@anshumanjaiswal
Copy link

@rvaidun, @AndriiSherman before giving my effort to it, can you please let me know if you can assign it to me?

@hckhanh
Copy link

hckhanh commented Dec 27, 2023

+1000 for this

@davidaragundy
Copy link

any updates? 👀

@laurent512
Copy link

+1 +1 +1 +1

@raiyansarker
Copy link

Is there any update on this?

@ghyath5
Copy link

ghyath5 commented Jul 16, 2024

+2392394

@xuxucode
Copy link

+2024

@feng-derivio
Copy link

+10086

@qhkm
Copy link

qhkm commented Aug 16, 2024

+2028812

@TFaesen
Copy link

TFaesen commented Aug 20, 2024

+111

@qhkm
Copy link

qhkm commented Sep 7, 2024

+9999999999

@SimCall
Copy link

SimCall commented Sep 10, 2024

@april83c
Copy link

If one more person posts a +1 instead of clicking the 👍 reaction I will cry

@schndra
Copy link

schndra commented Sep 17, 2024

+0.1

@yas1nshah
Copy link

+1

1 similar comment
@Senbonzakura1234
Copy link

+1

@AndriiSherman
Copy link
Member Author

Available in drizzle-orm@0.35.0 and drizzle-kit@0.26.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drizzle/kit enhancement New feature or request
Projects
None yet
Development

No branches or pull requests