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 #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions dirs/ecommerce/migrations/20240917131046.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "users" table
ALTER TABLE `users` DROP COLUMN `profile_picture_url`;

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

View workflow job for this annotation

GitHub Actions / atlas

destructive changes detected

Dropping non-virtual column "profile_picture_url" (DS103) Details: https://atlasgo.io/lint/analyzers#DS103
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

destructive changes detected
Dropping non-virtual column "profile_picture_url" DS103

Add a pre-migration check to ensure column "profile_picture_url" is NULL before dropping it

Suggested change
-- Modify "users" table
ALTER TABLE `users` DROP COLUMN `profile_picture_url`;
-- atlas:txtar
-- checks/destructive.sql --
-- atlas:assert DS103
SELECT NOT EXISTS (SELECT 1 FROM `users` WHERE `profile_picture_url` IS NOT NULL) AS `is_empty`;
-- migration.sql --
-- Modify "users" table
ALTER TABLE `users` DROP COLUMN `profile_picture_url`;

Ensure to run atlas migrate hash --dir "file://dirs/ecommerce/migrations" after applying the suggested changes.

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:uxeCQck9ZYGdn4OmVrXawyBbDHC3UXHC1KyJmEjiLEU=
h1:Mq7ivohci5yqXwOCTIyyFUsEP7tWvoKq7ynC6brYkUg=
20230316085611.sql h1:br6W6LPEnnsejlz/7hRm9zthwStCzjN2vZkqVPxlmvo=
20230316090502.sql h1:GfeRjkSeoCt3JVRtLQNa/r50lRfpAPXS7AqTU2ZNFgY=
20230531091333_products_categories.sql h1:59q2M59dV5dJNv4Lyb2TAJz8V6HekgkLn9z4DoL98jA=
Expand Down Expand Up @@ -46,3 +46,4 @@ h1:uxeCQck9ZYGdn4OmVrXawyBbDHC3UXHC1KyJmEjiLEU=
20240903131010.sql h1:GGqMn45ltGFdUkBkGu+Z1BK582+Cb3jPSv0PtZDyg80=
20240912131026.sql h1:8CLY6M0lRS5nb2BU2i2+6o/BY4iszNkAVQfkuLnalwU=
20240915130904.sql h1:0HwnmWE/zmhRTkKqUi2AL08YpWaQKiv7L+obJEG36jM=
20240917131046.sql h1:+q/DmHSX6S+dSLPNj75mVSOdQ+aW+/N5I+yhYJ8Cfe0=
3 changes: 1 addition & 2 deletions dirs/ecommerce/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ CREATE TABLE `users` (
`active` bool NOT NULL DEFAULT 1,
`last_login` timestamp NULL,
`address` varchar(255) NULL,
`profile_picture_url` varchar(255) NULL,
`phone_verified` bool NOT NULL DEFAULT 0,
`deleted_at` timestamp NULL,
PRIMARY KEY (`id`),
Expand Down Expand Up @@ -142,4 +141,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;
Loading