Skip to content

Commit

Permalink
Added a UNIQUE constraint to the 'user_name' column in the 'users' ta…
Browse files Browse the repository at this point in the history
…ble to enforce unique usernames.
  • Loading branch information
GitHub Gen Changes committed Aug 1, 2024
1 parent 183f2b1 commit 28a665c
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/20240801083707.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "users" table
ALTER TABLE `users` ADD UNIQUE INDEX `user_name` (`user_name`);

Check warning on line 2 in dirs/ecommerce/migrations/20240801083707.sql

View workflow job for this annotation

GitHub Actions / atlas

data dependent changes detected

Adding a unique index "user_name" on table "users" might fail in case column "user_name" 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:ag/hSSF2oVKFPE9F/IplLMOPlyvQd0gXcpVyLHhXv0U=
h1:Ap7xMN9V1zyLgjBJwn9epFduJ1QnnCkyJgTxoacsNjc=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -28,3 +28,4 @@ h1:ag/hSSF2oVKFPE9F/IplLMOPlyvQd0gXcpVyLHhXv0U=
20240723130918.sql h1:7UFf+5hmmm/hJZdmF1lvHCz+GYQKbSkxAUK6Q41kVXs=
20240725130853.sql h1:8wHRNNINenYDpavChvcXopJj7i2i88dKydkPoZ+3biE=
20240728130515.sql h1:f32S9I3rYZ1KIUsnLpIyCMc/nxv2U8AqCmpA/95S8ls=
20240801083707.sql h1:87RLzlaeNBXjfXtSlg3G/IAPqye2IeKogJCJTvpPTXA=
3 changes: 2 additions & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ CREATE TABLE `users` (
`last_login` timestamp NULL,
`address` varchar(255) NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `email` (`email`)
UNIQUE INDEX `email` (`email`),
UNIQUE INDEX `user_name` (`user_name`)
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

-- Create 'categories' table
Expand Down

0 comments on commit 28a665c

Please sign in to comment.