Laravel 根据数据库生成migration

情况:
接手了一个laravel项目,这个项目居然没有migration, 而是手动建的表,据说是因为需求变更太频繁了…
于是我有了这个操作.
Laravel 版本5.4.36

步骤:
1.安装

composer require --dev "xethron/migrations-generator"

2.配置
添加下面两行到config/app.php文件的providers:

Way\Generators\GeneratorsServiceProvider::class,
Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,

3.执行

php artisan migrate:generate

4.补充
暂不支持Laravel 6,如果需要,尝试这个https://github.com/oscarafdev/migrations-generator

你可能感兴趣的:(Laravel,laravel,migration)