photo/database/migrations/2016_07_01_131722_rename_photo_people.php

38 lines
1007 B
PHP
Raw Normal View History

<?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');
}
}