2016-12-29 18:35:34 +03:00
|
|
|
<?php
|
2015-10-07 00:41:40 +03:00
|
|
|
$I = new AcceptanceTester($scenario);
|
|
|
|
|
|
|
|
$I->wantTo('generate a pivot table');
|
2017-01-18 18:55:18 +03:00
|
|
|
$I->runShellCommand('php artisan wn:pivot-table Tag Project --add=timestamps --file=pivot_table');
|
2015-10-07 00:41:40 +03:00
|
|
|
$I->seeInShellOutput('project_tag migration generated');
|
|
|
|
$I->seeFileFound('./database/migrations/pivot_table.php');
|
|
|
|
$I->openFile('./database/migrations/pivot_table.php');
|
|
|
|
$I->seeFileContentsEqual('<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
2015-10-07 19:49:26 +03:00
|
|
|
class CreateProjectTagTable extends Migration
|
2015-10-07 00:41:40 +03:00
|
|
|
{
|
2016-12-29 18:35:34 +03:00
|
|
|
|
2015-10-07 00:41:40 +03:00
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create(\'project_tag\', function(Blueprint $table) {
|
|
|
|
$table->increments(\'id\');
|
|
|
|
$table->integer(\'project_id\')->unsigned()->index();
|
|
|
|
$table->integer(\'tag_id\')->unsigned()->index();
|
|
|
|
$table->foreign(\'project_id\')
|
|
|
|
->references(\'id\')
|
|
|
|
->on(\'projects\');
|
|
|
|
$table->foreign(\'tag_id\')
|
|
|
|
->references(\'id\')
|
|
|
|
->on(\'tags\');
|
|
|
|
$table->timestamps();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::drop(\'project_tag\');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
');
|
2017-01-18 18:55:18 +03:00
|
|
|
$I->deleteFile('./database/migrations/pivot_table.php');
|