Skip to content

Commit

Permalink
Added a default value for the 'quantity' field in the 'inventory' tab…
Browse files Browse the repository at this point in the history
…le to ensure smooth record creation with the initial value set to 0. (#106)

Co-authored-by: GitHub Gen Changes <>
  • Loading branch information
ariga-bot authored Oct 31, 2024
1 parent 94a81ab commit fd4a051
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20241031131151.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "inventory" table
ALTER TABLE `inventory` MODIFY COLUMN `quantity` int NOT NULL DEFAULT 0 COMMENT "Available quantity of the product in the fulfillment center";
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:STK2H155MS9kSfE50qCHNSawXtDIWlc1iuQS518bApQ=
h1:/EGuxbuZGme8egHJYvmz3VubDspuHPLNzmF29uRQadk=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -55,3 +55,4 @@ h1:STK2H155MS9kSfE50qCHNSawXtDIWlc1iuQS518bApQ=
20241027112248.sql h1:Uz/zd2cH0VzbQuO8TcENLacZimgQA9XIdHmL+det8Lc=
20241027144749.sql h1:0OTheGU7/lbJB+NXlrmAVMNonIFH89tj9dzW6EByorg=
20241029131228.sql h1:DzldiBTksxEdcKfy5vyShSvEE6Q5iU2m7NShpkUwCRA=
20241031131151.sql h1:XisKAigww2gisByYOPuIgNQcBOVX/AVKLNt0KGPrlU0=
6 changes: 2 additions & 4 deletions dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ CREATE TABLE `inventory` (
`id` int NOT NULL COMMENT 'Unique identifier for each inventory record',
`product_id` int NOT NULL COMMENT 'Foreign key referencing the product',
`fulfillment_center_id` int NOT NULL COMMENT 'Foreign key referencing the fulfillment center',
`quantity` int NOT NULL COMMENT 'Available quantity of the product in the fulfillment center',
`quantity` int NOT NULL DEFAULT 0 COMMENT 'Available quantity of the product in the fulfillment center',
PRIMARY KEY (`id`),
INDEX `fulfillment_center_id` (`fulfillment_center_id`),
INDEX `product_id` (`product_id`),
Expand Down Expand Up @@ -150,6 +150,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 fd4a051

Please sign in to comment.