blue-twilight/database/migrations/2016_09_24_083659_add_album...

38 lines
848 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAlbumStorageColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('albums', function (Blueprint $table) {
$table->unsignedInteger('storage_id');
$table->foreign('storage_id')
->references('id')->on('storages')
->onDelete('no action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('albums', function (Blueprint $table) {
$table->dropForeign('albums_storage_id_foreign');
$table->dropColumn('storage_id');
});
}
}