Skip to content

Commit fa30f50

Browse files
authored
Changed the 'currency_code' column data type from 'varchar(3)' to 'char(3)' to optimize storage and ensure fixed length for currency codes. (#231)
Co-authored-by: GitHub Gen Changes <>
1 parent 003a284 commit fa30f50

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "products" table
2+
ALTER TABLE `products` MODIFY COLUMN `currency_code` char(3) NOT NULL DEFAULT "USD" COMMENT "Currency code for the product price";

dirs/ecommerce/migrations/atlas.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:R6Ns7NRQCq1SEsqXVch/ps32Gt0VG7hSh/5oGqeFQv0=
1+
h1:kBWfSSoa+I2fVhYYSjj6j4RNcOw5qQL041hh3YZkjlo=
22
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
33
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
44
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
@@ -127,3 +127,4 @@ h1:R6Ns7NRQCq1SEsqXVch/ps32Gt0VG7hSh/5oGqeFQv0=
127127
20251028131811.sql h1:xdufTvtim9PduqOSdtT7SBk19y1YXowkPcR3QXiuHa4=
128128
20251030131819.sql h1:lFWnjBrFnMv7M3DG8NTMbJv4wacnOHla4wVdYj/JkLY=
129129
20251102131140.sql h1:6m5KVCL6GmycOmkwBCJRcpxm+RSsFPbV4UMMZQrBKrc=
130+
20251104132019.sql h1:/+MEE2P3Q6Ll/lxa5YXW6tew/5Pldx1K/j4xFHqlWEs=

dirs/ecommerce/schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ CREATE TABLE `products` (
5959
`id` int NOT NULL COMMENT 'Unique identifier for each product',
6060
`product_name` varchar(255) NOT NULL COMMENT 'Name of the product',
6161
`price` decimal(10,2) NOT NULL COMMENT 'Price of the product',
62-
`currency_code` varchar(3) NOT NULL DEFAULT 'USD' COMMENT 'Currency code for the product price',
62+
`currency_code` char(3) NOT NULL DEFAULT 'USD' COMMENT 'Currency code for the product price',
6363
`category_id` int NULL COMMENT 'Foreign key referencing categories',
6464
`description` text NULL COMMENT 'Description of the product',
6565
`color` varchar(50) NULL COMMENT 'Color of the product, optional',

0 commit comments

Comments
 (0)