relationships and database edits

This commit is contained in:
2018-11-05 21:46:20 -06:00
parent 834ddfe34f
commit 1735935e45
3 changed files with 5 additions and 4 deletions
@@ -17,7 +17,7 @@ class CreateUsersTable extends Migration
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('character_id')->unique();
$table->integer('character_id')->unsigned()->unique();
$table->string('avatar');
$table->string('access_token')->nullable();
$table->string('refresh_token')->nullable();
@@ -16,9 +16,10 @@ class CreateUserRolesTable extends Migration
if(!Schema::hasTable('user_roles')) {
Schema::create('user_roles', function (Blueprint $table) {
$table->increments('id');
$table->integer('character_id')->index();
$table->string('role')->default('None');
$table->integer('character_id')->unsigned();
$table->foreign('character_id')->references('character_id')->on('users');
$table->string('role')->default('None');
$table->timestamps();
});
}
@@ -17,7 +17,7 @@ class CreateEsiScopes extends Migration
Schema::create('EsiScopes', function(Blueprint $table) {
$table->increments('id');
$table->integer('character_id');
$table->foreign('character_id')->references('character_id')->on('EsiToken');
$table->foreign('character_id')->references('character_id')->on('EsiTokens');
$table->string('scope');
$table->timestamps();
});