Duplicate statements after adding .unique()

Starting from a schema that is entirely synced, I add one .unique() constraint on one of my columns, then run drizzle-kit push and I get the following
Warning You are about to execute current statements:

ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);

❯ No, abort
Yes, I want to execute all statements
Warning You are about to execute current statements:

ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);

❯ No, abort
Yes, I want to execute all statements
This will throw InvalidArgument desc = Duplicate key name 'MailingList_email_unique' (errno 1061) (sqlstate 42000) when trying to execute the second statement, but it will at least add it. Now that the key exists, on subsequent calls (without changing anything) it will try to remove it and add it again!
DROP INDEX `MailingList_email_unique` ON ``.`MailingList`;
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
DROP INDEX `MailingList_email_unique` ON ``.`MailingList`;
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
ALTER TABLE `MailingList` ADD CONSTRAINT `MailingList_email_unique` UNIQUE(`email`);
I am using "drizzle-kit": "^0.21.1"and "drizzle-orm": "^0.30.10" and PlanetScale (MySQL). Any support would be greatly appreciated! Thank you.
0 Replies
No replies yetBe the first to reply to this messageJoin