spacegrass/laravel-migrations-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spacegrass/laravel-migrations-generator

Composer 安装命令:

composer require spacegrass/laravel-migrations-generator

包简介

Generates Laravel Migrations from an existing database

README 文档

README

Generate Laravel Migrations from an existing database, including indexes and foreign keys!

Laravel 5 installation

The recommended way to install this is through composer:

composer require --dev "spacegrass/laravel-migrations-generator"

In Laravel 5.5 the service providers will automatically get registered.

In older versions of the framework edit config/app.php and add this to providers section:

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

If you want this lib only for dev, you can add the following code to your app/Providers/AppServiceProvider.php file, within the register() method:

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Way\Generators\GeneratorsServiceProvider::class);
        $this->app->register(\Spacegrass\MigrationsGenerator\MigrationsGeneratorServiceProvider::class);
    }
    // ...
}

Usage

To generate migrations from a database, you need to have your database setup in Laravel's Config.

Run php artisan migrate:generate to create migrations for all the tables, or you can specify the tables you wish to generate using php artisan migrate:generate table1,table2,table3,table4,table5. You can also ignore tables with --ignore="table3,table4,table5"

Laravel Migrations Generator will first generate all the tables, columns and indexes, and afterwards setup all the foreign key constraints. So make sure you include all the tables listed in the foreign keys so that they are present when the foreign keys are created.

You can also specify the connection name if you are not using your default connection with --connection="connection_name"

Run php artisan help migrate:generate for a list of options.

The Laravel Migrations Generator is open-sourced software licensed under the MIT license

Testing

To run tests, create a new laravel project locally, ie laravel new test-migrations-generator

in the root directory, run git submodule add https://github.com/dallincoons/laravel-migrations-generator.git package which will install the package into a direvtory called package

in the root directories composer.json file, add

"repositories": [
        {
            "type": "path",
            "url": "./package"
        }
    ]

and then run composer require spacegrass/laravel-migrations-generator @dev

now in config/app.php, add the providers:

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

navigate into the package directory, composer install, and now you should be able to run the tests: vendor/bin/phpunit

统计信息

  • 总下载量: 123
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固