filippo-toso/migrations-generator
Composer 安装命令:
composer require filippo-toso/migrations-generator
包简介
A Laravel Artisan command to automatically generate migrations from database tables
README 文档
README
A Laravel Artisan command to automatically generate migrations from database tables.
Requirements
- PHP 5.6+
- Laravel 5.4+
- Doctrine DBAL +2.8
Installing
Use Composer to install it:
composer require filippo-toso/migrations-generator
How does it work?
This generator is very simple. It builds the migrations from the database and saves them in the database folder.
By default the generator doesn't create the models of Laravel's tables like jobs, cache, and so on. You can modify this behavior publishing the package resources and editing the config/migrations-generator.php file.
Configuration
You can publish the configuration file with the following command:
php artisan vendor:publish --tag=config --provider="FilippoToso\MigrationsGenerator\ServiceProvider"
The config/migration-generator.php file allows you to:
- define which tables exclude form the generation (ie. cache, jobs, migrations, ...)
Just open the file and read the comments :)
Options
The predefined use from command line is:
php artisan generate:migrations
This command generates the migrations with the current time (plus one second for each table).
If there are existing migrations they will not be overwritten.
You can modify the default behavior using the following parameters:
php artisan generate:migrations --overwrite
With the overwrite option the generator will remove the previously generated migrations with the same class name.
php artisan generate:migrations --connection=sqlite
You can specify a different connection if you need to.
Workflow
To gain the maximum benefits from this package you should follow this workflow:
- design the database (i.e. with MySQL Workbench)
- execute the SQL CREATE statement in your MySQL
- configure the generator
- run the generator
- customize the migrations in the database folder
You must follow Laravel's guidelines about tables and columns names and also include in your SQL statements all the required foreign keys and indexes.
Known Issues
If you have two (or more) tables inter-related, you will need to manually move the foreign key definitions in a separate migrations that will run after all the tables has been created
filippo-toso/migrations-generator 适用场景与选型建议
filippo-toso/migrations-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 204 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 filippo-toso/migrations-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 filippo-toso/migrations-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 204
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-15