Здравствуйте, у меня есть таблица, которая выглядит следующим образом
CREATE TABLE `ratings` (
`id` bigint NOT NULL,
`profile_id` bigint NOT NULL,
`stars` enum('1','2','3','4','5') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`survey_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ratings_profile_id_email_unique` (`profile_id`,`email`),
UNIQUE KEY `ratings_token_unique` (`token`),
KEY `survey_id` (`survey_id`),
CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`survey_id`) REFERENCES `surveys` (`id`),
CONSTRAINT `ratings_profile_id_foreign` FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
Моя цель - удалить ключ ratings_profile_id_email_unique
. Я пытался это утверждение
alter table ratings drop key ratings_profile_id_email_unique;
Это производит: Cannot drop index 'ratings_profile_id_email_unique': needed in a foreign key constraint
Что не так? Как уникальный ключ может понадобиться в ограничении fk?