How can I create migration from existing database?

2019-09-20 19:17发布

问题:

How can I create migration from existing database? I wanted to do this with Xerton. I try do execute:

php artisan make:migration

But I'm getting this error:

Not enough arguments (missing: "name").

Is it possible to migrate the existing database at once? Without having to migrate the tables separately?

回答1:

When you create a migration you have to specify the name of the migration like this :

php artisan make:migration create_users_table
php artisan make:migration add_votes_to_users_table

With Xerton :

Run php artisan migrate:generate to create migrations for all the table



回答2:

After you've correctly installed Xethron you could run this commands:

php artisan migrate:generate // to create migrations for all the tables
php artisan migrate:generate table1,table2,table3,table4,table5 // for specific tables


回答3:

According to Xerton documentation you have to use php artisan migrate:generate command to generate migrations from existing database.

php artisan make:migration [name] is used to create new migration.