From 8f0b3ace92be6f858e0e4d894372671ce4095290 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Oct 2020 18:20:41 -0700 Subject: [PATCH] Manuall created oauth tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We shouldn’t have to do this, but… --- ...1_000001_create_oauth_auth_codes_table.php | 37 +++++++++++++++++ ...00002_create_oauth_access_tokens_table.php | 40 +++++++++++++++++++ ...0003_create_oauth_refresh_tokens_table.php | 35 ++++++++++++++++ ...6_01_000004_create_oauth_clients_table.php | 40 +++++++++++++++++++ ...te_oauth_personal_access_clients_table.php | 35 ++++++++++++++++ .../2019_12_04_223111_passport_upgrade.php | 16 +++++--- 6 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php create mode 100644 database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php create mode 100644 database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php create mode 100644 database/migrations/2016_06_01_000004_create_oauth_clients_table.php create mode 100644 database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php diff --git a/database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php b/database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php new file mode 100644 index 0000000000..a7261b4278 --- /dev/null +++ b/database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php @@ -0,0 +1,37 @@ +string('id', 100)->primary(); + $table->unsignedBigInteger('user_id')->index(); + $table->unsignedBigInteger('client_id'); + $table->text('scopes')->nullable(); + $table->boolean('revoked'); + $table->dateTime('expires_at')->nullable(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('oauth_auth_codes'); + } +} diff --git a/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php b/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php new file mode 100644 index 0000000000..ca15e62454 --- /dev/null +++ b/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php @@ -0,0 +1,40 @@ +string('id', 100)->primary(); + $table->unsignedBigInteger('user_id')->nullable()->index(); + $table->unsignedBigInteger('client_id'); + $table->string('name')->nullable(); + $table->text('scopes')->nullable(); + $table->boolean('revoked'); + $table->timestamps(); + $table->dateTime('expires_at')->nullable(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('oauth_access_tokens'); + } +} diff --git a/database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php b/database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php new file mode 100644 index 0000000000..9d7327d69c --- /dev/null +++ b/database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php @@ -0,0 +1,35 @@ +string('id', 100)->primary(); + $table->string('access_token_id', 100); + $table->boolean('revoked'); + $table->dateTime('expires_at')->nullable(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('oauth_refresh_tokens'); + } +} diff --git a/database/migrations/2016_06_01_000004_create_oauth_clients_table.php b/database/migrations/2016_06_01_000004_create_oauth_clients_table.php new file mode 100644 index 0000000000..65937a72af --- /dev/null +++ b/database/migrations/2016_06_01_000004_create_oauth_clients_table.php @@ -0,0 +1,40 @@ +bigIncrements('id'); + $table->unsignedBigInteger('user_id')->nullable()->index(); + $table->string('name'); + $table->string('secret', 100)->nullable(); + $table->text('redirect'); + $table->boolean('personal_access_client'); + $table->boolean('password_client'); + $table->boolean('revoked'); + $table->timestamps(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('oauth_clients'); + } +} diff --git a/database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php b/database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php new file mode 100644 index 0000000000..b469b42364 --- /dev/null +++ b/database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->unsignedBigInteger('client_id'); + $table->timestamps(); + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('oauth_personal_access_clients'); + } +} diff --git a/database/migrations/2019_12_04_223111_passport_upgrade.php b/database/migrations/2019_12_04_223111_passport_upgrade.php index e38ff4654f..02cbe56dec 100644 --- a/database/migrations/2019_12_04_223111_passport_upgrade.php +++ b/database/migrations/2019_12_04_223111_passport_upgrade.php @@ -13,9 +13,11 @@ class PassportUpgrade extends Migration */ public function up() { - Schema::table('oauth_clients', function (Blueprint $table) { - $table->string('secret', 100)->nullable()->change(); - }); + if (Schema::hasTable('oauth_clients')) { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->string('secret', 100)->nullable()->change(); + }); + } } /** @@ -25,8 +27,10 @@ class PassportUpgrade extends Migration */ public function down() { - Schema::table('oauth_clients', function (Blueprint $table) { - $table->string('secret', 100)->change(); - }); + if (Schema::hasTable('oauth_clients')) { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->string('secret', 100)->change(); + }); + } } }