如何从现有数据库创建迁移? [英] How can I create migration from existing database?

查看:98
本文介绍了如何从现有数据库创建迁移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从现有数据库创建迁移? 我想用Xerton做到这一点.我尝试执行:

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

php artisan make:migration

但是我收到此错误:

Not enough arguments (missing: "name").

是否可以一次迁移现有数据库?不必单独迁移表?

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

推荐答案

创建迁移时,您必须像这样指定迁移的名称:

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

使用Xerton:

运行php artisan migration:generate为所有表创建迁移

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

这篇关于如何从现有数据库创建迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆