We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-unique
A UNIQUE index permits multiple NULL values for columns that can contain NULL.
UNIQUE
NULL
CREATE TABLE `progress` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `plan_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `question_id` int(10) unsigned NOT NULL, `resolved_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_plan_progress_unique` (`user_id`,`question_id`,`deleted_at`), KEY `users_plan_progress_plan_id_index` (`plan_id`) ) ENGINE=InnoDB;
CREATE TABLE `progress` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `plan_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `question_id` int(10) unsigned NOT NULL, `resolved_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `is_not_archived` tinyint(4) GENERATED ALWAYS AS (if((`deleted_at` is null),1,NULL)) VIRTUAL, PRIMARY KEY (`id`), UNIQUE KEY `users_plan_progress_unique` (`user_id`,`question_id`,`is_not_archived`), KEY `users_plan_progress_plan_id_index` (`plan_id`) ) ENGINE=InnoDB;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-unique
Links
Examples
Fixed
The text was updated successfully, but these errors were encountered: