Prevent an exception when creating databases with the same name on multiple hosts.
closes #1456
This commit is contained in:
parent
91c9cbba6f
commit
8253246955
4 changed files with 63 additions and 2 deletions
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixUniqueIndexToAccountForHost extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->dropUnique(['database']);
|
||||
$table->dropUnique(['username']);
|
||||
|
||||
$table->unique(['database_host_id', 'database']);
|
||||
$table->unique(['database_host_id', 'username']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('databases', function (Blueprint $table) {
|
||||
$table->dropUnique(['database_host_id', 'database']);
|
||||
$table->dropUnique(['database_host_id', 'username']);
|
||||
|
||||
$table->unique(['database']);
|
||||
$table->unique(['username']);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue