Dropping mysql unique errors

Hello! I saw there were already an issue created for it https://github.com/drizzle-team/drizzle-orm/issues/998 database: mysql package: drizzle-kit my own error message
errno: 3821,
sql: 'ALTER TABLE `cerberus_auth_user` DROP CONSTRAINT `cerberus_auth_user_username_unique`;',
sqlState: 'HY000',
sqlMessage: `target: personal.-.primary: vttablet: rpc error: code = Unknown desc = Check constraint 'cerberus_auth_user_username_unique' is not found in the table. (errno 3821) (sqlstate HY000) (CallerID: 1t4od6gbcxmj1mldqj6f): Sql: "alter table cerberus_auth_user drop check cerberus_auth_user_username_unique", BindVars: {REDACTED}`
errno: 3821,
sql: 'ALTER TABLE `cerberus_auth_user` DROP CONSTRAINT `cerberus_auth_user_username_unique`;',
sqlState: 'HY000',
sqlMessage: `target: personal.-.primary: vttablet: rpc error: code = Unknown desc = Check constraint 'cerberus_auth_user_username_unique' is not found in the table. (errno 3821) (sqlstate HY000) (CallerID: 1t4od6gbcxmj1mldqj6f): Sql: "alter table cerberus_auth_user drop check cerberus_auth_user_username_unique", BindVars: {REDACTED}`
I realized that the SQL query for dropping a UNIQUE the CONSTRAINT should be changed to INDEX
ALTER TABLE `[table here]` DROP INDEX `[constraint name]`
ALTER TABLE `[table here]` DROP INDEX `[constraint name]`
I ran the the above query in planetscale's console, and it successfully dropped the UNIQUE CONSTRAINT and then ran db:push and it successfully made the changes ๐Ÿ™‚ I tried looking (but i am dumb) to see where the query for the drizzle-kit DROP statement would be built but I could not find anything ๐Ÿ˜ฆ would love to make a PR on this if possible ๐Ÿ™‚
GitHub
[BUG]: Cannot drop Unique Constraint MySQL ยท Issue #998 ยท drizzle-t...
What version of drizzle-orm are you using? 0.28.1 What version of drizzle-kit are you using? 0.19.12 Describe the Bug Create a mysql table with a unique constraint Drizzle-kit push Delete the uniqu...
1 Reply
melodyclue
melodyclueโ€ข15mo ago
I have the same problem!
Want results from more Discord servers?
Add your server