laravel migrate

1、已有数据库生成laravel migrations迁移文件

1)安装sequel pro build版本,支持mysql 8,地址: https://sequelpro.com/test-builds

2)安装插件,https://github.com/cviebrock/sequel-pro-laravel-export,下载完毕后,文件打开ExportToLaravelMigration.spBundle文件

3)在sqauel pro中,选中要导出迁移文件的表,Bundles–>Export–>Export To Laravel Migration。

2、生成数据表

1)将生成的migration迁移文件导入工程的database–>migrations文件夹下

2)执行命令:

> php artisan migrate:install
#错误处理:Base table or view already exists: 1050 Table 'migrations' already exists
#直接将原有数据库中的migations表删掉,重新运行install命令
> php artisan migrate:install
Migration table created successfully.
> php artisan migrate
#直接生成数据表

猜你喜欢

转载自blog.csdn.net/u012160319/article/details/83353005