testing
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if(!Schema::hasTable('available_user_roles')) {
|
||||
Schema::createTable('available_user_roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('role');
|
||||
$table->string('description');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if(!Schema::hasTable('user_roles')) {
|
||||
Schema::createTable('user_roles', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('character_id')->unique();
|
||||
$table->string('role')->default('Guest');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('character_id', 'fk_user_roles_character_id')
|
||||
->references('character_id')
|
||||
->on('users')
|
||||
->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
if(!Schema::hasTable('user_permissions')) {
|
||||
Schema::createTable('user_permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedBigInteger('character_id');
|
||||
$table->string('permission');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('character_id', 'fk_user_permissions_character_id')
|
||||
->references('character_id')
|
||||
->on('users')
|
||||
->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
if(!Schema::hasTable('available_user_permissions')) {
|
||||
Schema::createTable('available_user_permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('permission');
|
||||
$table->text('description');
|
||||
$table->timestamps();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_roles');
|
||||
Schema::dropIfExists('user_permissions');
|
||||
Schema::dropIfExists('available_user_roles');
|
||||
Schema::dropIfExists('available_user_permissions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user