blue-twilight/database/migrations/2020_04_19_181020_add_servi...

38 lines
892 B
PHP

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