Skip to content

Commit f606c84

Browse files
authored
Changed the column in the 'users' table from int to unsigned int to prevent negative values from being entered and stored. (#223)
Co-authored-by: GitHub Gen Changes <>
1 parent a946840 commit f606c84

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-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 `reward_points` int unsigned NOT NULL DEFAULT 0 COMMENT "The number of reward points the user has accumulated";

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:dzVmHTqt6HMOQTKN9QBCadrrvFaLOYsDwORucWTz0WI=
1+
h1:YodBqt1I5FIBweHFkOJcxmb3H6oTiO+DbYtK3TNJAWA=
22
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
33
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
44
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
@@ -120,3 +120,4 @@ h1:dzVmHTqt6HMOQTKN9QBCadrrvFaLOYsDwORucWTz0WI=
120120
20251005131122.sql h1:4NichqlFjq/DCea9zYN/6hr2kNOImPrDGYKfOFQVh6Q=
121121
20251009131617.sql h1:Wyu0Lzz5OcwuHF6nazgcEA+bzKtV3rDYVtt130IUhsY=
122122
20251012131138.sql h1:EekLeCP8SbeXXAiHv8uLZONf3R26QC4SLDPvUFUhrEU=
123+
20251014131636.sql h1:H+TdxVhp81gf70E6COjZe2scq0h2kO53k0fQ6v5533k=

dirs/ecommerce/schema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CREATE TABLE `users` (
1616
`last_login` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of the last login of the user',
1717
`address` varchar(255) NOT NULL COMMENT 'Address of the user, now required',
1818
`profile_picture_url` varchar(255) NULL COMMENT 'URL to the user profile picture',
19-
`reward_points` int NOT NULL DEFAULT 0 COMMENT 'The number of reward points the user has accumulated',
19+
`reward_points` int unsigned NOT NULL DEFAULT 0 COMMENT 'The number of reward points the user has accumulated',
2020
`phone_verified` bool NOT NULL DEFAULT 0 COMMENT 'Flag indicating if the user phone number is verified, defaults to false',
2121
`deleted_at` timestamp NULL COMMENT 'Timestamp for soft deletion of the user record',
2222
`last_order_date` date NULL COMMENT 'Date of the users last order',
@@ -211,4 +211,4 @@ BEGIN
211211
IF NEW.total_amount < order_total THEN
212212
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Order total amount must be greater than or equal to the total price of the order items';
213213
END IF;
214-
END;
214+
END;

0 commit comments

Comments
 (0)