lawrence/fast-migrate 问题修复 & 功能扩展

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

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

lawrence/fast-migrate

最新稳定版本:v1.2

Composer 安装命令:

composer require lawrence/fast-migrate

包简介

Migrate even faster!

README 文档

README

Migrate even faster with FastMigrate! FastMigrate is essentially a wrapper around Laravels migration class. FastMigrate aims to make creating tables easier and faster.

FastMigrate requires Laravel >= 5.0

Installation

To install, simply composer require lawrence/fast-migrate:dev-master

Example

An example of FastMigrate in use is shown below.

<?php

use FastMigrate\FastMigrator;
use Schema;

class ExampleMigration extends FastMigrator
{

    public function up()
    {
        $I = $this;
        $I->wantATable('users')
            ->withStrings('username', 'password');

        $I->wantATable('roles')
            ->withStrings('description');

        $I->wantATable('posts')
            ->withStrings('title', 'content')
            ->withIntegers('score');

        $I->want('users')
            ->toHaveMany('posts');
        $I->want('users')
            ->toHaveOne('roles');

        $I->amReadyForMigration();
    }

    public function down()
    {
        Schema::dropIfExists('users');
        Schema::dropIfExists('posts');
        Schema::dropIfExists('roles');
    }
}

Running the above migration will generate three tables as follows:

- users:
    - id
    - created_at
    - updated_at
    - username
    - password
    - role_id

- roles:
    - id
    - created_at
    - updated_at
    - description

- posts:
    - id
    - created_at
    - updated_at
    - title
    - content
    - score
    - user_id

统计信息

  • 总下载量: 55
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-03