51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
|
||
|
class UniqueRelations extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::table('node_setup', function (Blueprint $table) {
|
||
|
$table->unique(['node_id','setup_id']);
|
||
|
});
|
||
|
Schema::table('domain_user', function (Blueprint $table) {
|
||
|
$table->unique(['domain_id','user_id']);
|
||
|
});
|
||
|
Schema::table('node_system', function (Blueprint $table) {
|
||
|
$table->unique(['node_id','system_id']);
|
||
|
});
|
||
|
Schema::table('system_user', function (Blueprint $table) {
|
||
|
$table->unique(['system_id','user_id']);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::table('node_setup', function (Blueprint $table) {
|
||
|
$table->dropUnique(['node_id','setup_id']);
|
||
|
});
|
||
|
Schema::table('domain_user', function (Blueprint $table) {
|
||
|
$table->dropUnique(['domain_id','user_id']);
|
||
|
});
|
||
|
Schema::table('node_system', function (Blueprint $table) {
|
||
|
$table->dropUnique(['node_id','system_id']);
|
||
|
});
|
||
|
Schema::table('system_user', function (Blueprint $table) {
|
||
|
$table->dropUnique(['system_id','user_id']);
|
||
|
});
|
||
|
}
|
||
|
}
|