Peit
Peit
DTDrizzle Team
Created by Peit on 1/14/2025 in #help
Custom unique index
I used unique().on() before but now i need custom constraints generating sql similar like:
CREATE UNIQUE INDEX unique_combination ON linked_items (
LEAST(column1, column2),
GREATEST(column2, column1)
)
CREATE UNIQUE INDEX unique_combination ON linked_items (
LEAST(column1, column2),
GREATEST(column2, column1)
)
can i do this in the schema? would rather not edit the generated sql file
1 replies
DTDrizzle Team
Created by Peit on 4/14/2024 in #help
`ADD COLUMN` and `RENAME COLUMN` migration issues
Ran migrations with drizzle-kit push:pg before, but that gives problems in our automated workflow because it asks interactively in case of deletions. So now i want to run it with the drizzle migrator (from node-postgres) but that gives errors because columns already exist for ADD COLUMN statements. I've searched the discord and followed the suggestion to edit the migration files and add IF NOT EXISTS, that worked. But now later migration files fail because there's RENAME COLUMN, and that operation doesn't have a IF NOT EXISTS option. What can I do here? If possible I prefer not to edit migration files or the db directly.
3 replies