I'm having some roadblock on Laravel 4.
Since I can't make artisan:migrate
generate migrations from inner folders of app/database/migrations
(ex: app/database/migrations/app1)
I have this on my custom command app:migrate
/* default path */
$this->call('migrate');
/* custom path */
$this->call('migrate', array('--path' => 'app/database/migrations/app1'));
but i also want an app:refresh
command which will rollback all the migrations from the custom path then from the default path.. then re migrate and seed everything just like what migrate:refresh --seed
does
how do i reverse this? calling:
$this->call('migrate:rollback', array('--path' => 'app/database/migrations/app1'));
will produce an error saying
[InvalidArgumentException]
The "--path" option does not exist.
can somebody help please.
thanks!
You can rollback your migration by using rake db:rollback with different options. The syntax will be different according to your requirements. where n is number of migrations to rollback, counting from latest migration. where xxxxx is the version number of the migration.
To create a new migration, you can run the make:migration Artisan command and that will bootstrap a new class on your Laravel application, in the database/migrations folder. This class will contain a default boilerplate code.
use Undo Seeder for Laravel. When you install UndoSeeder, the following artisan commands are made available: db:seed-undo Undo seeds in the seeds directory. db:seed-refresh Undo seeds run seeds again.
All you have to do is make sure your migration classes can be autoloaded. The easiest way to do so is to add the path to the folder you're keeping them to composer.json
's autoload.classmap
:
...
"autoload": {
"classmap": [
...
"app/database/migrations/app1",
]
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With