Skip to content

Commit

Permalink
Added a 'currency_code' column to the 'products' table with a default…
Browse files Browse the repository at this point in the history
… value of 'USD', representing the currency in which the product price is listed. (#107)

Co-authored-by: GitHub Gen Changes <>
  • Loading branch information
ariga-bot authored Nov 5, 2024
1 parent fd4a051 commit 30d773c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20241105131055.sql
Original file line number Diff line number Diff line change
@@ -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";
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:/EGuxbuZGme8egHJYvmz3VubDspuHPLNzmF29uRQadk=
h1:4DPrdpTqQndedAjeax6vOukg4FQNAlTRXrcWZ6yEmCQ=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -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=
5 changes: 3 additions & 2 deletions dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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` (
Expand All @@ -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;
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

0 comments on commit 30d773c

Please sign in to comment.