How can I create migration from existing database?

我是研究僧i 提交于 2019-12-25 17:19:33

问题


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.



来源:https://stackoverflow.com/questions/57198718/how-can-i-create-migration-from-existing-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!