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

fix(cleanup): convert cleanup migration to command #467

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

anehx
Copy link
Member

@anehx anehx commented Jan 21, 2022

The cleanup migration is too dangerous since it will possibly delete production data if something goes wrong. This commit converts the migration to a command which can be called manually and has a dry run option to test it beforehand.

@anehx anehx requested a review from czosel January 21, 2022 10:10
@anehx anehx force-pushed the convert-migration-to-command branch from 2f87637 to 3726786 Compare January 21, 2022 10:13
@anehx anehx requested a review from winged January 21, 2022 10:17
if (
path not in used_files
and os.path.isfile(path)
and path.endswith(".docx")
Copy link
Member

Choose a reason for hiding this comment

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

Not sure this endswith restriction is actually needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

if not options.get("dry"):
os.remove(path)
self.stdout.write(
self.style.SUCCESS(f"Deleted dangling file '{path}'")
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: change the message depending on dry mode

Copy link
Member Author

Choose a reason for hiding this comment

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

Valid point! Done.

Copy link
Contributor

@czosel czosel left a comment

Choose a reason for hiding this comment

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

👍

The cleanup migration is too dangerous since it will possibly delete
production data if something goes wrong. This commit converts the
migration to a command which can be called manually and has a dry run
option to test it beforehand.
@anehx anehx force-pushed the convert-migration-to-command branch from 3726786 to 7373a1e Compare January 21, 2022 10:28
@winged winged merged commit 33052ee into main Jan 21, 2022
@anehx anehx deleted the convert-migration-to-command branch August 9, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants