From c460612bd717195d337b55628befc8e637bd3286 Mon Sep 17 00:00:00 2001 From: GitHub Gen Changes <> Date: Wed, 21 Aug 2024 08:13:00 +0000 Subject: [PATCH] Added a 'discount' column to the 'products' table to store discount percentage. --- dirs/ecommerce/migrations/20240821081259.sql | 2 ++ dirs/ecommerce/migrations/atlas.sum | 3 ++- dirs/ecommerce/schema.sql | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 dirs/ecommerce/migrations/20240821081259.sql diff --git a/dirs/ecommerce/migrations/20240821081259.sql b/dirs/ecommerce/migrations/20240821081259.sql new file mode 100644 index 0000000..2548888 --- /dev/null +++ b/dirs/ecommerce/migrations/20240821081259.sql @@ -0,0 +1,2 @@ +-- Modify "products" table +ALTER TABLE `products` ADD COLUMN `discount` decimal(5,2) NOT NULL DEFAULT 0.00; diff --git a/dirs/ecommerce/migrations/atlas.sum b/dirs/ecommerce/migrations/atlas.sum index 22a0ed9..69e402e 100644 --- a/dirs/ecommerce/migrations/atlas.sum +++ b/dirs/ecommerce/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:F5vyrLbKMXOYPLGiHNkkChAJyQefbZb+LN685IeDtVA= +h1:klRMbqUTOA/dSZVjBsjuxm2Tyc6vUWKTAfWOOSpNQrU= 20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo= 20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY= 20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA= @@ -37,3 +37,4 @@ h1:F5vyrLbKMXOYPLGiHNkkChAJyQefbZb+LN685IeDtVA= 20240815125449.sql h1:3vhjuCKKwckYQX7JIEFDL6hfjoiHFD5iECEmgfdvcHI= 20240820130921.sql h1:jI1wgEMLFJ90gSqeQLR1y5PSCWnWX+lmwAE8WXy4Nws= 20240821074731.sql h1:rl5aXrs4DpADb0//yv8LtzrT07jUdpGf4MmcZhKV4XM= +20240821081259.sql h1:jo+miAHGZoIxX6DsIanS8zi/9gvff/qeh6ncJ6Nxw1Q= diff --git a/dirs/ecommerce/schema.sql b/dirs/ecommerce/schema.sql index 47e9f58..7182b1b 100644 --- a/dirs/ecommerce/schema.sql +++ b/dirs/ecommerce/schema.sql @@ -35,6 +35,7 @@ CREATE TABLE `products` ( `image_url` varchar(255) NULL, `featured` bool NOT NULL DEFAULT 0, `status` varchar(50) NOT NULL DEFAULT 'active', +`discount` decimal(5,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`id`), INDEX `category_id` (`category_id`), UNIQUE INDEX `product_name` (`product_name`), @@ -133,4 +134,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; +) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci; \ No newline at end of file