© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
9 replies
focused_morning

How can I accomplish this in a schema?

I'm trying to make it so only one record with this itemId can have the status "ACTIVE" at a time. Something like this:

ALTER TABLE ItemMintPermission
ADD COLUMN ActiveItemID AS (CASE WHEN status='ACTIVE' THEN itemId ELSE NULL END) VIRTUAL;

ALTER TABLE ItemMintPermission
ADD UNIQUE INDEX idx_unique_active_item(ActiveItemID);
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How can I use a schema to generate something like this:
Drizzle TeamDTDrizzle Team / help
3y ago
How to do this in drizzle schema?
Drizzle TeamDTDrizzle Team / help
3y ago
How can I configure `drizzle-kit introspect` to generate a schema with a schema?
Drizzle TeamDTDrizzle Team / help
2y ago
How can I generate / migrate a schema if I'm using an in-memory Postgresql?
Drizzle TeamDTDrizzle Team / help
2y ago