© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•6mo ago•
2 replies
jsingleton37

Adding unique() to an existing table in Supabase

Is it possible to add
(table) => [unique().on(table.userId, table.division, table.week, table.year, table.sportId)]
(table) => [unique().on(table.userId, table.division, table.week, table.year, table.sportId)]
on an existing table? I just noticed that duplicate data has been entered into one of my tables from a form that's submitted on my site. I just realized it happened last year once and then again this year. LKooking at my schema I don't have a
unique()
unique()
for this particular table. Is it possible to add that and then run
drizzle-kit generate
drizzle-kit generate
followed by a
drizzle-kit migrate
drizzle-kit migrate
to then add that? Will it mess anything up with the existing tabler?

Also, can I update an existing
unique
unique
?
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

Cannot drop unique index of an empty table in planetscale
Drizzle TeamDTDrizzle Team / help
16mo ago
How to add a new column to an existing table
Drizzle TeamDTDrizzle Team / help
2y ago
How to consume existing supabase migration?
Drizzle TeamDTDrizzle Team / help
3y ago
Duplicate statements after adding .unique()
Drizzle TeamDTDrizzle Team / help
2y ago