Skip to content

Commit fccddec

Browse files
authored
Change the column in the table to use a type instead of to save storage space, as country codes are typically a maximum of 3 characters. (#218)
Co-authored-by: GitHub Gen Changes <>
1 parent 207e377 commit fccddec

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "users" table
2+
ALTER TABLE `users` MODIFY COLUMN `country_code` char(3) NOT NULL DEFAULT "+1" COMMENT "Country code for the phone number, defaults to US";

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:pjwMbMgdZ9uLQsWf3MSQ5qbLJ6s0cnDWHc8xwdv7Rek=
1+
h1:OoG5u7SBdU/IWamO3zzpHA4+gHJ3G7L/jPrAQhByQG0=
22
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
33
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
44
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
@@ -117,3 +117,4 @@ h1:pjwMbMgdZ9uLQsWf3MSQ5qbLJ6s0cnDWHc8xwdv7Rek=
117117
20250731132135.sql h1:cSy+4lVYqqbIXlorpnJl9jOYmgqPppfToXj07fTbr/Q=
118118
20250926101825.sql h1:B3sRWA5wE928msWaRR7DAqEJ8cWLKQmZ1Zzl31HYg4U=
119119
20250929100600.sql h1:6ocCYCEihVznrZa0Guqxj0hW57lWzHoyoWYwjgL8yZY=
120+
20251005131122.sql h1:4NichqlFjq/DCea9zYN/6hr2kNOImPrDGYKfOFQVh6Q=

dirs/ecommerce/schema.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
21
-- Create 'users' table
32
CREATE TABLE `users` (
43
`id` int NOT NULL COMMENT 'Unique identifier for each user',
54
`user_name` varchar(255) COLLATE utf8mb4_0900_as_ci NOT NULL COMMENT 'The username of the user, must be unique',
65
`email_address` varchar(255) NOT NULL,
76
`phone_number` varchar(15) NOT NULL,
8-
`country_code` varchar(5) NOT NULL DEFAULT '+1' COMMENT 'Country code for the phone number, defaults to US',
7+
`country_code` char(3) NOT NULL DEFAULT '+1' COMMENT 'Country code for the phone number, defaults to US',
98
`is_admin` bool NULL DEFAULT 0 COMMENT 'Flag indicating if the user is an admin, defaults to false',
109
`email_verified` bool NOT NULL DEFAULT 0 COMMENT 'Flag indicating if the user email address is verified, defaults to false',
1110
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of when the user was created',

0 commit comments

Comments
 (0)