next commit

This commit is contained in:
2019-09-26 01:45:12 -05:00
parent e94b153718
commit 89a691af52
22 changed files with 1505 additions and 37 deletions

View File

@@ -13,15 +13,110 @@ class CreateUsersTable extends Migration
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
if(!Schema::hasTable('users')) {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('character_id')->unsigned()->unique();
$table->string('avatar');
$table->string('access_token')->nullable();
$table->string('refresh_token')->nullable();
$table->integer('inserted_at')->default(0);
$table->integer('expires_in')->default(0);
$table->string('owner_hash');
$table->string('user_type')->default('Guest');
$table->timestamps();
});
}
if(!Schema::hasTable('user_roles')) {
Schema::create('user_roles', function (Blueprint $table) {
$table->increments('id');
$table->integer('character_id')->unsigned();
$table->foreign('character_id')->references('character_id')->on('users');
$table->string('role')->default('None');
$table->timestamps();
});
}
if(!Schema::hasTable('esi_tokens')) {
Schema::create('esi_tokens', function (Blueprint $table) {
$table->increments('id');
$table->integer('character_id')->unique();
$table->foreign('character_id')->references('character_id')->on('users');
$table->string('access_token');
$table->string('refresh_token');
$table->integer('expires_in');
$table->timestamps();
});
}
if(!Schema::hasTable('esi_scopes')) {
Schema::create('esi_scopes', function (Blueprint $table) {
$table->increments('id');
$table->integer('character_id');
$table->foreign('character_id')->references('character_id')->on('users');
$table->string('scope');
$table->timestamps();
});
}
if(!Schema::hasTable('user_permissions')) {
Schema::create('user_permissions', function (Blueprint $table) {
$table->increments('id');
$table->integer('character_id')->unisnged();
$table->foreign('character_id')->references('character_id')->on('users');
$table->string('permission');
$table->timestamps();
});
}
if(!Schema::hasTable('available_user_permissions')) {
Schema::create('available_user_permissions', function (Blueprint $table) {
$table->increments('id');
$table->string('permission');
});
}
if(!Schema::hasTable('available_user_roles')) {
Schema::create('available_user_roles', function (Blueprint $table) {
$table->increments('id');
$table->string('role');
$table->string('description');
$table->timestamps();
});
DB::table('available_user_roles')->insert([
'role' => 'Guest',
'description' => 'Guest of the site.',
]);
DB::table('available_user_roles')->insert([
'role' => 'User',
'description' => 'User with non-admin access.',
]);
DB::table('available_user_roles')->insert([
'role' => 'Admin',
'description' => 'User with admin access.',
]);
DB::table('available_user_roles')->insert([
'role' => 'SuperUser',
'description' => 'SuperUser',
]);
}
if(!Schema::hasTable('allowed_logins')) {
Schema::create('allowed_logins', function (Blueprint $table) {
$table->increments('id');
$table->string('entity_id');
$table->string('entity_type');
$table->string('entity_name');
$table->string('login_type');
$table->timestamps();
});
}
}
/**
@@ -32,5 +127,12 @@ class CreateUsersTable extends Migration
public function down()
{
Schema::dropIfExists('users');
Schema::dropIfExists('user_roles');
Schema::dropIfExists('esi_tokens');
Schema::dropIfExists('esi_scopes');
Schema::dropIfExists('user_permissions');
Schema::dropIfExists('available_user_permissions');
Schema::dropIfExists('available_user_roles');
Schema::dropIfExists('allowed_logins');
}
}