tnagengast's avatar

Creating Migrations From a Controller Using Laravel 5 Extended Generators

Any suggestions on creating migrations via code from a controller?

When running:

Artisan::call('make:migration:schema', ['name' => 'create_test_table', '--schema' => 'username:string, email:string:unique']);

no migration is created.

https://github.com/laracasts/Laravel-5-Generators-Extended

0 likes
5 replies
pmall's avatar

Why do you ever want to do this ?

tnagengast's avatar

Basically I need to sync my database tables with object fields over an api. I'd like to use the schema returned to resync my local database. The output I've created to set the database up from the command like works great, but I can't seem to get it to fire from my controller.

1 like
oburatongoi's avatar

@rm, not sure if you ever found the solution to this, but found this on SO:

Artisan::call('migrate', array('--path' => 'app/migrations', '--force' => true));
1 like

Please or to participate in this conversation.