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

[5.7] Add --step to migrate:fresh command #25897

Merged
merged 2 commits into from
Oct 3, 2018
Merged

[5.7] Add --step to migrate:fresh command #25897

merged 2 commits into from
Oct 3, 2018

Conversation

connectkushal
Copy link
Contributor

@connectkushal connectkushal commented Oct 3, 2018

The migrate:fresh is a useful command, but currently there is no option to repeat the migration in steps using migrate:fresh when required.

This pr adds the missing feature, which can be run by adding --step option to migrate:fresh
php artisan migrate:fresh --step

It is a non breaking change and works as intended with other options as well.

Adds a flag to enable running migrations in step with the migrate:fresh command
@connectkushal connectkushal changed the title Add --step to migrate:fresh command [5.7] Add --step to migrate:fresh command Oct 3, 2018
@SjorsO
Copy link
Contributor

SjorsO commented Oct 3, 2018

This was rejected before: #24939

@connectkushal
Copy link
Contributor Author

connectkushal commented Oct 3, 2018

Heres a use case. When working on a new feature on a project which has many migrations, sometimes I need to run migrate:fresh --seed once, but subsequently it would have been very convenient to just rollback the last or last few migrations instead of re-running all of them if the migrations were run in steps. Not doing so i have to wait for all the migrations to rerun along with seeds which takes a lot of time. Or i have to drop tables manually, and run migrate --step which is not very neat.

One of the reasons why i need to run migrate:fresh once is sometimes, if the some migration was messed up, the table is created or updated in db, but it doesn't show up in the migrate:status. From this point I cannot work with migration again unless i do a migrate:fresh, but then i cannot rollback the last migration if i want to as migrate fresh doesn't have the option to re run migrations in steps.

Currently getting this done by a simple bash script, but would rather prefer adding simple --step to the existing command over custom scripts.

@taylorotwell taylorotwell merged commit c0518f5 into laravel:5.7 Oct 3, 2018
@connectkushal connectkushal deleted the patch-1 branch October 3, 2018 14:04
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