Add database host management to panel.

This commit is contained in:
Dane Everitt 2017-03-16 19:35:29 -04:00
parent 5bbded2c03
commit 198a021a97
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 605 additions and 125 deletions

View file

@ -0,0 +1,48 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ReOrganizeDatabaseServersToDatabaseHost extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign(['linked_node']);
});
Schema::rename('database_servers', 'database_hosts');
Schema::table('database_hosts', function (Blueprint $table) {
$table->renameColumn('linked_node', 'node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('database_hosts', function (Blueprint $table) {
$table->dropForeign(['node_id']);
});
Schema::rename('database_hosts', 'database_servers');
Schema::table('database_servers', function (Blueprint $table) {
$table->renameColumn('node_id', 'linked_node');
$table->foreign('linked_node')->references('id')->on('nodes');
});
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CleanupDatabasesDatabase extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('databases', function (Blueprint $table) {
$table->dropForeign(['db_server']);
$table->renameColumn('db_server', 'database_host_id');
$table->foreign('database_host_id')->references('id')->on('database_hosts');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('databases', function (Blueprint $table) {
$table->dropForeign(['database_host_id']);
$table->renameColumn('database_host_id', 'db_server');
$table->foreign('db_server')->references('id')->on('database_hosts');
});
}
}