Skip to content

Commit

Permalink
Added a 'shipping_address' field to the 'orders' table to store the s…
Browse files Browse the repository at this point in the history
…hipping address for each order.
  • Loading branch information
GitHub Gen Changes committed Aug 6, 2024
1 parent 2fa540e commit 3429506
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/20240806130855.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "orders" table
ALTER TABLE `orders` ADD COLUMN `shipping_address` varchar(255) NOT NULL;

Check warning on line 2 in dirs/ecommerce/migrations/20240806130855.sql

View workflow job for this annotation

GitHub Actions / atlas

data dependent changes detected

Adding a non-nullable "varchar" column "shipping_address" on table "orders" without a default value implicitly sets existing rows with "" (MY101) Details: https://atlasgo.io/lint/analyzers#MY101
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:6kfFz/E9odd4UTioGGmPzrRQmxK3gCYpkSnYRHGCPak=
h1:luWIccvAY7xNWVYnfbb7RnEtJTviDThL+UZK3SGv8XM=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -31,3 +31,4 @@ h1:6kfFz/E9odd4UTioGGmPzrRQmxK3gCYpkSnYRHGCPak=
20240801083707.sql h1:87RLzlaeNBXjfXtSlg3G/IAPqye2IeKogJCJTvpPTXA=
20240801130915.sql h1:wqC2zDRfVQWUWiV5ItznG3xy2zN7hCr7dGLdLFYW6+c=
20240804130742.sql h1:kB1qxstPuROcCPaWyqXh0ZnjpBsOSxGRLQJTa+CP03w=
20240806130855.sql h1:rsSJMFdmgp33FVqqG5ONW+F8tv3+x1D2xEn+ATwNJw0=
5 changes: 3 additions & 2 deletions dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Create 'users' table
-- Create 'users' table
CREATE TABLE `users` (
`id` int NOT NULL,
`user_name` varchar(255) NOT NULL,
Expand Down Expand Up @@ -83,6 +83,7 @@ CREATE TABLE `orders` (
`total_amount` decimal(10,2) NOT NULL,
`comment` varchar(100) NULL,
`status` varchar(50) NOT NULL DEFAULT 'PENDING',
`shipping_address` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
Expand Down Expand Up @@ -127,4 +128,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 3429506

Please sign in to comment.