Preferred way of adding generated column and unique partial index in schema

I want to add something like this sql in my schema:
ALTER TABLE TaskUsers
ADD COLUMN is_assignee BOOLEAN GENERATED ALWAYS AS (role = 'assignee') STORED;

CREATE UNIQUE INDEX idx_unique_assignee
ON TaskUsers (taskId, is_assignee)
WHERE is_assignee;
ALTER TABLE TaskUsers
ADD COLUMN is_assignee BOOLEAN GENERATED ALWAYS AS (role = 'assignee') STORED;

CREATE UNIQUE INDEX idx_unique_assignee
ON TaskUsers (taskId, is_assignee)
WHERE is_assignee;
what is the preferred way of doing this in drizzle?
2 Replies
Angelelz
Angelelz16mo ago
GitHub
[FEATURE]: ORM Schema for Generated Columns · Issue #579 · drizzle-...
Hi! I have a column in a table which is a Generated Column. Is there a solution for drizzle orm pgTable schema columns that are Generated Columns? Do you have a solution for this in the meantime? T...
Angelelz
Angelelz16mo ago
That's how I did it
Want results from more Discord servers?
Add your server