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.1] Implemented 'logging' and 'file' options for the artisan migrate command #10726

Closed
wants to merge 8 commits into from

Conversation

20TRIES
Copy link
Contributor

@20TRIES 20TRIES commented Oct 25, 2015

The benefits of logging are obvious in production when the integrity and state of the database are vital; however, often during development migrations will be run many times to test and debug them. Currently this process is quite difficult and often means either executing the rollback command after each migration (assuming this method is error free) or updating the migrations table in the database.

There was an issue a while back about a similar thing #2085

By adding the --file option, a single migration file can be run (it accepts both a full file name or just the migration name; minus the timestamp prefix)

By adding the --logging=0 option logging can be disabled so that a migration can be run many times without altering the database or rolling back.

Anyways its the first time i have contributed to Laravel so if i have missed anything then just let me know. Im happy to write more tests to cover the new options etc, just wanted to see if there was any interest and to make sure that this doesn't go against the general idea of how migrations should be used before doing any more.

@@ -34,8 +34,7 @@ class MigrateCommand extends BaseCommand
/**
* Create a new migration command instance.
*
* @param \Illuminate\Database\Migrations\Migrator $migrator
* @return void
* @param Migrator $migrator
Copy link
Member

Choose a reason for hiding this comment

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

please revert all changes to the phpdoc

@GrahamCampbell
Copy link
Member

Please fix the numerous CS issues as highlighted by StyleCI for you.

@GrahamCampbell GrahamCampbell changed the title Implemented 'logging' and 'file' options for the artisan migrate command [5.1] Implemented 'logging' and 'file' options for the artisan migrate command Oct 25, 2015
@taylorotwell
Copy link
Member

This should have really been two different PRs. We don't have any plans to add a --file option to migrations as is to doesn't really make sense to run individual files when migrations are specifically supposed to be run in a given order.

@20TRIES
Copy link
Contributor Author

20TRIES commented Oct 25, 2015

Yer i wondered whether that may go against the general use case for migrations; figured it was worth a mention though as i tend to run the migrations quite a lot when writing/debugging.

That being said, it works just as well to implement this in the service providers without too much hassle so maybe its better placed in a blog post for the edge case uses :)

@camel-chased
Copy link

when you working on some project and you don't want to remove all your current data for some reasons and want to add next table there is a problem

there are seeds but sometimes it is not that simple - when your data must be created with other actions as well,
or you are extending your application and there is a large data in db that you don't want dump

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.

4 participants