2017-02-03 20:19:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class UpdateNodesTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
2022-11-25 20:29:04 +00:00
|
|
|
public function up(): void
|
2017-02-03 20:19:14 +00:00
|
|
|
{
|
|
|
|
Schema::table('nodes', function (Blueprint $table) {
|
2022-11-25 20:29:04 +00:00
|
|
|
$table->dropForeign(['location']);
|
2017-02-03 20:19:14 +00:00
|
|
|
|
|
|
|
$table->renameColumn('location', 'location_id');
|
|
|
|
$table->foreign('location_id')->references('id')->on('locations');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
2022-11-25 20:29:04 +00:00
|
|
|
public function down(): void
|
2017-02-03 20:19:14 +00:00
|
|
|
{
|
|
|
|
Schema::table('nodes', function (Blueprint $table) {
|
2022-11-25 20:29:04 +00:00
|
|
|
$table->dropForeign(['location_id']);
|
2017-02-03 20:19:14 +00:00
|
|
|
|
|
|
|
$table->renameColumn('location_id', 'location');
|
|
|
|
$table->foreign('location')->references('id')->on('locations');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|