mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 22:03:44 +02:00
Don't allow creation of a database with an identical name for the same server; closes #2447
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeUniqueDatabaseNameToAccountForServer extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->dropUnique(['database_host_id', 'database']);
|
||||
});
|
||||
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->unique(['database_host_id', 'server_id', 'database']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->dropUnique(['database_host_id', 'server_id', 'database']);
|
||||
});
|
||||
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->unique(['database_host_id', 'database']);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user