lawrence/fast-migrate
Migrate even faster!
55
3
| Install | |
|---|---|
composer require lawrence/fast-migrate |
|
| Latest Version: | v1.2 |
| PHP: | >=5.4.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Nov 4, 2015 |
| Links: | GitHub · Packagist |
Maintainer: lwakefield
FastMigrate
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
Related Packages
rexlu/ardent
Self-validating smart models for Laravel 4.2 Eloquent ORM and add some ORM funct...
10
1
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.2 | >=5.4.0 | 5.* | MIT | |
| v1.1 | >=5.4.0 | 5.* | MIT | |
| v1.0 | >=5.4.0 | 5.* | MIT |