DT
Join ServerDrizzle Team
help
Check
Hello there, from this discussion: https://discord.com/channels/1043890932593987624/1090486363251544124/1093092996200796200
Is it the way to add
It produces nothing in the generated migration 🧐
drizzle-kit: v0.17.4
drizzle-orm: v0.23.5
Is it the way to add
check
constraint?const companySize = ["tpe", "pme", "eti", "ge"] as const;
export const Company = pgTable(
"company",
{
id: uuid("id").defaultRandom().primaryKey(),
companySize: text("company_size", { enum: [...companySize] }).notNull()
},
(Company) => ({
onlyTheseSize: check(
"only_these_size",
sql`${Company.companySize} in(${companySize.join(",")})`
),
})
);
It produces nothing in the generated migration 🧐
drizzle-kit: v0.17.4
drizzle-orm: v0.23.5
Looks correct
@Andrii Sherman
Yeah, drizzle kit is not aware of any checks yet
But we will add support for it
Have in backlog
Workaround to write them manually
Same as you did with unique constraints
Haha sorry to be a deep source code reader 😂
you found an easter egg 🥚