From 30d773cba59079d16debfb6bb7270cc478144884 Mon Sep 17 00:00:00 2001 From: Ariga Bot <98804354+ariga-bot@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:04:36 +0200 Subject: [PATCH] Added a 'currency_code' column to the 'products' table with a default value of 'USD', representing the currency in which the product price is listed. (#107) Co-authored-by: GitHub Gen Changes <> --- dirs/ecommerce/migrations/20241105131055.sql | 2 ++ dirs/ecommerce/migrations/atlas.sum | 3 ++- dirs/ecommerce/schema.sql | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 dirs/ecommerce/migrations/20241105131055.sql diff --git a/dirs/ecommerce/migrations/20241105131055.sql b/dirs/ecommerce/migrations/20241105131055.sql new file mode 100644 index 0000000..1e0ca25 --- /dev/null +++ b/dirs/ecommerce/migrations/20241105131055.sql @@ -0,0 +1,2 @@ +-- Modify "products" table +ALTER TABLE `products` ADD COLUMN `currency_code` varchar(3) NOT NULL DEFAULT "USD" COMMENT "Currency code for the product price"; diff --git a/dirs/ecommerce/migrations/atlas.sum b/dirs/ecommerce/migrations/atlas.sum index 3fa932f..f3bd413 100644 --- a/dirs/ecommerce/migrations/atlas.sum +++ b/dirs/ecommerce/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:/EGuxbuZGme8egHJYvmz3VubDspuHPLNzmF29uRQadk= +h1:4DPrdpTqQndedAjeax6vOukg4FQNAlTRXrcWZ6yEmCQ= 20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo= 20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY= 20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA= @@ -56,3 +56,4 @@ h1:/EGuxbuZGme8egHJYvmz3VubDspuHPLNzmF29uRQadk= 20241027144749.sql h1:0OTheGU7/lbJB+NXlrmAVMNonIFH89tj9dzW6EByorg= 20241029131228.sql h1:DzldiBTksxEdcKfy5vyShSvEE6Q5iU2m7NShpkUwCRA= 20241031131151.sql h1:XisKAigww2gisByYOPuIgNQcBOVX/AVKLNt0KGPrlU0= +20241105131055.sql h1:Pa43oRSXYgYlTyRPmz+ifOUdjC37MBxXty/y6GLCaqk= diff --git a/dirs/ecommerce/schema.sql b/dirs/ecommerce/schema.sql index 38ca3c1..59be2fe 100644 --- a/dirs/ecommerce/schema.sql +++ b/dirs/ecommerce/schema.sql @@ -40,6 +40,7 @@ CREATE TABLE `products` ( `id` int NOT NULL COMMENT 'Unique identifier for each product', `product_name` varchar(255) NOT NULL COMMENT 'Name of the product', `price` decimal(10,2) NOT NULL COMMENT 'Price of the product', + `currency_code` varchar(3) NOT NULL DEFAULT 'USD' COMMENT 'Currency code for the product price', `category_id` int NULL COMMENT 'Foreign key referencing categories', `description` text NULL COMMENT 'Description of the product', `image_url` varchar(255) NULL COMMENT 'URL to the product image', @@ -136,7 +137,7 @@ CREATE TABLE `posts` ( INDEX `user_id` (`user_id`), CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL - ) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci; +) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci; -- Create 'payment_methods' table CREATE TABLE `payment_methods` ( @@ -150,4 +151,4 @@ CREATE TABLE `payment_methods` ( PRIMARY KEY (`id`), 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 +) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci; \ No newline at end of file