Skip to content

Commit

Permalink
Added a default value for the 'gender' field in the 'users' table to …
Browse files Browse the repository at this point in the history
…improve data consistency and handle cases where specific gender data is not provided. The default value set is 'other'. (#138)

Co-authored-by: GitHub Gen Changes <>
  • Loading branch information
ariga-bot authored Jan 7, 2025
1 parent 38754fa commit d86fd40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20250107131148.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "users" table
ALTER TABLE `users` MODIFY COLUMN `gender` enum('male','female','other') NULL DEFAULT "other" COMMENT "User gender";
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:IYFRbQe36sOOtZW5CJso8BxeJn95HOiqPtGHkPUHLUY=
h1:PyuSKi9BXBDvy+W9BBkdYrmJkWFYBLC2Wv8c8l03NRY=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -68,3 +68,4 @@ h1:IYFRbQe36sOOtZW5CJso8BxeJn95HOiqPtGHkPUHLUY=
20241224131007.sql h1:OHMWMynd3YnU6t9QKs1R8ei2BbbNlZ66Tx73jgmeJUM=
20250102131036.sql h1:NEfnhChNfi18FzcgQ4Jsc1ygWpGH19GNvu98+3VVTgQ=
20250105130916.sql h1:J+F2PZSoMGyArqfu99kOHzOIHOFw/v4ps8CmFlqc0Fw=
20250107131148.sql h1:myfTSveM0wrY/UypJW3R/kZX8Dz4fW6w5/kAuYLncWM=
2 changes: 1 addition & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CREATE TABLE `users` (
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of when the user was created',
`updated_at` timestamp NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp of the last update to the user record',
`date_of_birth` date NULL,
`gender` ENUM('male', 'female', 'other') NULL COMMENT 'User gender',
`gender` ENUM('male', 'female', 'other') NULL DEFAULT 'other' COMMENT 'User gender',
`middle_name` varchar(255) NULL COMMENT 'Middle name of the user, optional',
`active` bool NOT NULL DEFAULT 1 COMMENT 'Flag indicating if the user account is active, defaults to true',
`last_login` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of the last login of the user',
Expand Down

0 comments on commit d86fd40

Please sign in to comment.