Package Data | |
---|---|
Maintainer Username: | lwakefield |
Maintainer Contact: | lawrence@iamlawrence.me (Lawrence Wakefield) |
Package Create Date: | 2015-09-01 |
Package Last Update: | 2015-11-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-17 03:01:29 |
Package Statistics | |
---|---|
Total Downloads: | 50 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
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
To install, simply composer require lawrence/fast-migrate:dev-master
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