2020-05-21 02:00:53 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
2020-05-21 02:57:30 +02:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2020-05-21 02:00:53 +02:00
|
|
|
|
|
|
|
class AddMountsTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
2022-11-25 21:29:04 +01:00
|
|
|
public function up(): void
|
2020-05-21 02:00:53 +02:00
|
|
|
{
|
|
|
|
Schema::create('mounts', function (Blueprint $table) {
|
2020-05-21 03:11:20 +02:00
|
|
|
$table->increments('id')->unique();
|
|
|
|
$table->char('uuid', 36)->unique();
|
|
|
|
$table->string('name')->unique();
|
2020-05-21 02:00:53 +02:00
|
|
|
$table->text('description')->nullable();
|
|
|
|
$table->string('source');
|
|
|
|
$table->string('target');
|
|
|
|
$table->tinyInteger('read_only')->unsigned();
|
|
|
|
$table->tinyInteger('user_mountable')->unsigned();
|
|
|
|
});
|
|
|
|
|
|
|
|
Schema::create('egg_mount', function (Blueprint $table) {
|
2020-05-21 03:11:20 +02:00
|
|
|
$table->integer('egg_id');
|
2020-05-21 22:23:12 +02:00
|
|
|
$table->integer('mount_id');
|
2020-05-21 04:50:56 +02:00
|
|
|
|
|
|
|
$table->unique(['egg_id', 'mount_id']);
|
2020-05-21 02:00:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Schema::create('mount_node', function (Blueprint $table) {
|
2020-05-21 03:11:20 +02:00
|
|
|
$table->integer('node_id');
|
2020-05-21 22:23:12 +02:00
|
|
|
$table->integer('mount_id');
|
2020-05-21 04:50:56 +02:00
|
|
|
|
|
|
|
$table->unique(['node_id', 'mount_id']);
|
2020-05-21 02:00:53 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
2022-11-25 21:29:04 +01:00
|
|
|
public function down(): void
|
2020-05-21 02:00:53 +02:00
|
|
|
{
|
|
|
|
Schema::dropIfExists('mount_node');
|
|
|
|
Schema::dropIfExists('egg_mount');
|
|
|
|
Schema::dropIfExists('mounts');
|
|
|
|
}
|
|
|
|
}
|