Skip to content

Commit

Permalink
Added a 'discount' column to the 'products' table to store discount p…
Browse files Browse the repository at this point in the history
…ercentage.
  • Loading branch information
GitHub Gen Changes committed Aug 21, 2024
1 parent ab3b716 commit c460612
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/20240821081259.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "products" table
ALTER TABLE `products` ADD COLUMN `discount` decimal(5,2) NOT NULL DEFAULT 0.00;
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:F5vyrLbKMXOYPLGiHNkkChAJyQefbZb+LN685IeDtVA=
h1:klRMbqUTOA/dSZVjBsjuxm2Tyc6vUWKTAfWOOSpNQrU=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -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=
3 changes: 2 additions & 1 deletion dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down Expand Up @@ -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;

0 comments on commit c460612

Please sign in to comment.