Skip to content

Commit

Permalink
Added a unique constraint on the 'email' column in the 'users' table …
Browse files Browse the repository at this point in the history
…to ensure that each user has a unique email address.
  • Loading branch information
GitHub Gen Changes committed Jul 14, 2024
1 parent 3367247 commit 9339ad4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20240714132123.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "users" table
ALTER TABLE `users` ADD UNIQUE INDEX `email` (`email`);

Check notice on line 2 in dirs/ecommerce/migrations/20240714132123.sql

View workflow job for this annotation

GitHub Actions / lint

data dependent changes detected

Adding a unique index "email" on table "users" might fail in case column "email" contains duplicate entries (MF101) Details: https://atlasgo.io/lint/analyzers#MF101
3 changes: 2 additions & 1 deletion dirs/ecommerce/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:8LeOgYv1dWVg/LAz7/Uv2sqRTcwUeEc5eTizTEVVgZE=
h1:66d9JjXdRay5AHv47FkWERP67UgtpudD5T8AE+rCIjQ=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand All @@ -21,3 +21,4 @@ h1:8LeOgYv1dWVg/LAz7/Uv2sqRTcwUeEc5eTizTEVVgZE=
20240702130812.sql h1:u9VyU0SQLuA1LotWpxsCyvEid5FMnrgatcn/P4S4F88=
20240704130806.sql h1:vUO9cakRAqDU9jNrQgE+qyWhWCkojRoWkjAtk9Z+wgY=
20240711130912.sql h1:ySpUVLDyz5QCRpeB3kaDVarV0hwqHEmwK9S5BEkG7Zo=
20240714132123.sql h1:lv0PHzxnTJyy62qY4O7uWPZ4nJHzuODG0PklM77dqtg=
3 changes: 2 additions & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ CREATE TABLE `users` (
`date_of_birth` date NULL,
`active` bool NOT NULL DEFAULT 1,
`last_login` timestamp NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE INDEX `email` (`email`)
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
-- Create "categories" table
CREATE TABLE `categories` (
Expand Down

0 comments on commit 9339ad4

Please sign in to comment.