Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema update #72

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dirs/ecommerce/migrations/20240728130649.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Modify "comments" table
ALTER TABLE `comments` DROP FOREIGN KEY `comments_ibfk_1`, DROP FOREIGN KEY `comments_ibfk_2`;

Check failure on line 2 in dirs/ecommerce/migrations/20240728130649.sql

View workflow job for this annotation

GitHub Actions / atlas

constraint deletion detected

Dropping foreign-key constraint "comments_ibfk_1" (CD101) Details: https://atlasgo.io/lint/analyzers#CD101

Check failure on line 2 in dirs/ecommerce/migrations/20240728130649.sql

View workflow job for this annotation

GitHub Actions / atlas

constraint deletion detected

Dropping foreign-key constraint "comments_ibfk_2" (CD101) Details: https://atlasgo.io/lint/analyzers#CD101
-- Drop "comments" table
DROP TABLE `comments`;

Check failure on line 4 in dirs/ecommerce/migrations/20240728130649.sql

View workflow job for this annotation

GitHub Actions / atlas

destructive changes detected

Dropping table "comments" (DS102) Details: https://atlasgo.io/lint/analyzers#DS102
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:ayF4SdmGNJPAnXTVxO6kwG4vxt98aJQaqurGP+fsnfs=
h1:6RkcQGhla6Li+07+718cEPKepozDfJJr1YXze1RD+Vg=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -27,3 +27,4 @@ h1:ayF4SdmGNJPAnXTVxO6kwG4vxt98aJQaqurGP+fsnfs=
20240721130705.sql h1:PeB5YebwZvu8tQrL6vMrPtL/PVLsgkZrw15bQx8Z/cc=
20240723130918.sql h1:7UFf+5hmmm/hJZdmF1lvHCz+GYQKbSkxAUK6Q41kVXs=
20240725130853.sql h1:8wHRNNINenYDpavChvcXopJj7i2i88dKydkPoZ+3biE=
20240728130649.sql h1:vFpJKysr7Xtov1nmHM5lMRHlkJ9fMd1yDM4Snc1xyDk=
21 changes: 3 additions & 18 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 @@ -52,22 +52,6 @@ CONSTRAINT `product_reviews_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `produ
CONSTRAINT `product_reviews_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

-- Create 'comments' table
CREATE TABLE `comments` (
`id` int NOT NULL,
`user_id` int NOT NULL,
`review_id` int NULL,
`parent_comment_id` int NULL,
`comment_text` text NOT NULL,
PRIMARY KEY (`id`),
INDEX `parent_comment_id` (`parent_comment_id`),
INDEX `review_id` (`review_id`),
INDEX `user_id` (`user_id`),
CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`review_id`) REFERENCES `product_reviews` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT `comments_ibfk_3` FOREIGN KEY (`parent_comment_id`) REFERENCES `comments` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE
) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

-- Create 'fulfillment_centers' table
CREATE TABLE `fulfillment_centers` (
`id` int NOT NULL,
Expand Down Expand Up @@ -129,4 +113,5 @@ CREATE TABLE `posts` (
PRIMARY KEY (`id`),
INDEX `user_id` (`user_id`),
CONSTRAINT `posts_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;

Loading