Enabled/Improved links to relationships

This commit is contained in:
Deon George
2016-07-01 14:37:55 +10:00
parent b8be45b42c
commit ad10cb32ce
5 changed files with 57 additions and 23 deletions

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenamePhotoPeople extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::rename('photo_people', 'person_photo');
Schema::table('person_photo', function (Blueprint $table) {
$table->dropForeign('person_photo_people_id_foreign');
$table->renameColumn('people_id', 'person_id');
$table->foreign('person_id')->references('id')->on('people');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('person_photo', function (Blueprint $table) {
$table->dropForeign('person_photo_person_id_foreign');
$table->renameColumn('person_id','people_id');
$table->foreign('people_id')->references('id')->on('people');
});
Schema::rename('person_photo','photo_people');
}
}