photo/database/migrations/2016_06_03_055605_add_foreign_keys_to_photo_people_table.php
2016-06-22 16:53:48 +10:00

38 lines
785 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPhotoPeopleTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('photo_people', function(Blueprint $table)
{
$table->foreign('people_id', 'fk_pp_p')->references('id')->on('people')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('photo_id', 'fk_pp_ph')->references('id')->on('photo')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('photo_people', function(Blueprint $table)
{
$table->dropForeign('fk_pp_p');
$table->dropForeign('fk_pp_ph');
});
}
}