From 94a81abc832d887cc25304ce4000490dc3d2172f Mon Sep 17 00:00:00 2001 From: Ariga Bot <98804354+ariga-bot@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:05:05 +0200 Subject: [PATCH] Added 'gender' column to the 'users' table with ENUM type for better data consistency. (#105) Co-authored-by: GitHub Gen Changes <> --- dirs/ecommerce/migrations/20241029131228.sql | 2 ++ dirs/ecommerce/migrations/atlas.sum | 3 ++- dirs/ecommerce/schema.sql | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 dirs/ecommerce/migrations/20241029131228.sql diff --git a/dirs/ecommerce/migrations/20241029131228.sql b/dirs/ecommerce/migrations/20241029131228.sql new file mode 100644 index 0000000..f68a415 --- /dev/null +++ b/dirs/ecommerce/migrations/20241029131228.sql @@ -0,0 +1,2 @@ +-- Modify "users" table +ALTER TABLE `users` ADD COLUMN `gender` enum('male','female','other') NULL COMMENT "User gender"; diff --git a/dirs/ecommerce/migrations/atlas.sum b/dirs/ecommerce/migrations/atlas.sum index f7af34b..5a9c689 100644 --- a/dirs/ecommerce/migrations/atlas.sum +++ b/dirs/ecommerce/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:NMi0fWXDuUkmq21unRIe6/tqtR44t7Mex/OPehuw+UA= +h1:STK2H155MS9kSfE50qCHNSawXtDIWlc1iuQS518bApQ= 20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo= 20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY= 20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA= @@ -54,3 +54,4 @@ h1:NMi0fWXDuUkmq21unRIe6/tqtR44t7Mex/OPehuw+UA= 20241022103333_add_comments.sql h1:/H61oAHrzxI4ZgrNQMApyTLkYeOKZB4qaATCEHJHFI8= 20241027112248.sql h1:Uz/zd2cH0VzbQuO8TcENLacZimgQA9XIdHmL+det8Lc= 20241027144749.sql h1:0OTheGU7/lbJB+NXlrmAVMNonIFH89tj9dzW6EByorg= +20241029131228.sql h1:DzldiBTksxEdcKfy5vyShSvEE6Q5iU2m7NShpkUwCRA= diff --git a/dirs/ecommerce/schema.sql b/dirs/ecommerce/schema.sql index 9e8d145..6c2f839 100644 --- a/dirs/ecommerce/schema.sql +++ b/dirs/ecommerce/schema.sql @@ -9,6 +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', `active` bool NOT NULL DEFAULT 1 COMMENT 'Flag indicating if the user account is active, defaults to true', `last_login` timestamp NULL, `address` varchar(255) NULL, @@ -150,3 +151,5 @@ CREATE TABLE `payment_methods` ( INDEX `user_id` (`user_id`), CONSTRAINT `payment_methods_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE ) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci; + + \ No newline at end of file