| @@ 7-39 (lines=33) @@ | ||
| 4 | use Illuminate\Database\Migrations\Migration; |
|
| 5 | use Illuminate\Database\Schema\Blueprint; |
|
| 6 | ||
| 7 | class CreateOauthAuthCodesTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (!Schema::hasTable('oauth_auth_codes')) { |
|
| 17 | Schema::create('oauth_auth_codes', function (Blueprint $table) { |
|
| 18 | $table->string('id', 100)->primary(); |
|
| 19 | $table->bigInteger('user_id'); |
|
| 20 | $table->unsignedInteger('client_id'); |
|
| 21 | $table->text('scopes')->nullable(); |
|
| 22 | $table->boolean('revoked'); |
|
| 23 | $table->dateTime('expires_at')->nullable(); |
|
| 24 | }); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Reverse the migrations. |
|
| 30 | * |
|
| 31 | * @return void |
|
| 32 | */ |
|
| 33 | public function down() |
|
| 34 | { |
|
| 35 | if (Schema::hasTable('oauth_auth_codes')) { |
|
| 36 | } |
|
| 37 | Schema::dropIfExists('oauth_auth_codes'); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | use Illuminate\Database\Migrations\Migration; |
|
| 5 | use Illuminate\Database\Schema\Blueprint; |
|
| 6 | ||
| 7 | class CreateOauthRefreshTokensTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (!Schema::hasTable('oauth_refresh_tokens')) { |
|
| 17 | Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
| 18 | $table->string('id', 100)->primary(); |
|
| 19 | $table->string('access_token_id', 100)->index(); |
|
| 20 | $table->boolean('revoked'); |
|
| 21 | $table->dateTime('expires_at')->nullable(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | if (Schema::hasTable('oauth_refresh_tokens')) { |
|
| 34 | Schema::dropIfExists('oauth_refresh_tokens'); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||