38 lines
785 B
PHP
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');
|
|
});
|
|
}
|
|
|
|
}
|