Files

39 lines
971 B
PHP
Raw Permalink Normal View History

2017-03-16 19:35:29 -04:00
<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
2017-03-16 19:35:29 -04:00
use Illuminate\Database\Migrations\Migration;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
2017-03-16 19:35:29 -04:00
class CleanupDatabasesDatabase extends Migration
{
/**
* Run the migrations.
*/
2024-10-21 19:18:20 -06:00
public function up(): void
2017-03-16 19:35:29 -04:00
{
2026-10-05 18:10:18 -04:00
Schema::table('databases', function (Blueprint $table): void {
2017-03-16 19:35:29 -04:00
$table->dropForeign(['db_server']);
$table->renameColumn('db_server', 'database_host_id');
$table->foreign('database_host_id')->references('id')->on('database_hosts');
});
}
/**
* Reverse the migrations.
*/
2024-10-21 19:18:20 -06:00
public function down(): void
2017-03-16 19:35:29 -04:00
{
2026-10-05 18:10:18 -04:00
Schema::table('databases', function (Blueprint $table): void {
2017-03-16 19:35:29 -04:00
$table->dropForeign(['database_host_id']);
$table->renameColumn('database_host_id', 'db_server');
$table->foreign('db_server')->references('id')->on('database_hosts');
});
}
}