forked from dahabit/Laravel-4-Generators
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d51d759
commit 77c8d95
Showing
8 changed files
with
138 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Feature: Migrations With Schema | ||
|
||
Scenario: Creating a Table | ||
When I generate a migration with name 'create_orders_table' and fields 'name:string' | ||
Then I should see "Created:" | ||
And the generated migration should match my 'CreateOrdersTable' stub | ||
|
||
Scenario: Creating a Table With Complex Fields | ||
When I generate a migration with name 'create_orders_table' and fields 'title:string(50):unique, body:text:unique:nullable' | ||
Then I should see "Created:" | ||
And the generated migration should match my 'CreateComplexOrdersTable' stub | ||
|
||
Scenario: Dropping a Table | ||
When I generate a migration with name 'drop_orders_table' and fields 'title:string' | ||
Then I should see "Created:" | ||
And the generated migration should match my 'DropOrdersTable' stub | ||
|
||
Scenario: Adding to a Table | ||
When I generate a migration with name 'add_title_to_orders_table' and fields 'title:string' | ||
Then I should see "Created:" | ||
And the generated migration should match my 'AddTitleToOrdersTable' stub | ||
|
||
Scenario: Removing from a Table | ||
When I generate a migration with name 'remove_title_from_orders_table' and fields 'title:string' | ||
Then I should see "Created:" | ||
And the generated migration should match my 'RemoveTitleFromOrdersTable' stub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class CreateOrdersTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('orders', function(Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('title', 50)->unique(); | ||
$table->text('body')->unique()->nullable(); | ||
}); | ||
} | ||
|
||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('orders'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class RemoveTitleFromOrdersTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('orders', function(Blueprint $table) { | ||
$table->dropColumn('title'); | ||
}); | ||
} | ||
|
||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('orders', function(Blueprint $table) { | ||
$table->string('title'); | ||
}); | ||
} | ||
|
||
} |