-
Notifications
You must be signed in to change notification settings - Fork 17
CLI: squash #390
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
base: master
Are you sure you want to change the base?
CLI: squash #390
Conversation
| /// Merge the most recent migration into the previous migration. | ||
| Squash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be SquashMigration ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have a slight preference for SquashMigration
| // Create a new migration that represents the squashed state, using the name of the second-to-last migration | ||
| ms.create_migration_to(&backends, &second_to_last_name, from_migration, target_db)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overwrites the .sql in the previous migration.
Maybe we need a prompt to ensure users understand this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this is the right behavior, but probably good to introduce user confirmation for (ideally with a flag to override the prompt if necessary to use it in a fully automated fashion)
| /// Merge the most recent migration into the previous migration. | ||
| Squash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have a slight preference for SquashMigration
| // Create a new migration that represents the squashed state, using the name of the second-to-last migration | ||
| ms.create_migration_to(&backends, &second_to_last_name, from_migration, target_db)?; | ||
|
|
||
| // Delete the old migration directories from the filesystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] It's only one directory we're deleting, not plural directories
| // Create a new migration that represents the squashed state, using the name of the second-to-last migration | ||
| ms.create_migration_to(&backends, &second_to_last_name, from_migration, target_db)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this is the right behavior, but probably good to introduce user confirmation for (ideally with a flag to override the prompt if necessary to use it in a fully automated fashion)
Semi-related to #91
A common case is a migration has been committed on a PR, but needs amending before approval & merging.