| @@ 7-46 (lines=40) @@ | ||
| 4 | use Illuminate\Database\Migrations\Migration; |
|
| 5 | use Illuminate\Support\Facades\Schema; |
|
| 6 | ||
| 7 | class CreateOAuthAuthCodesTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('oauth2_auth_codes', function(Blueprint $table) { |
|
| 17 | $table->char('id', 80)->primary(); |
|
| 18 | $table->char('user_id', 36); |
|
| 19 | $table->char('client_id', 36); |
|
| 20 | ||
| 21 | $table->foreign('user_id') |
|
| 22 | ->references('id')->on('oauth2_users') |
|
| 23 | ->onUpdate('cascade') |
|
| 24 | ->onDelete('cascade'); |
|
| 25 | ||
| 26 | $table->foreign('client_id') |
|
| 27 | ->references('id')->on('oauth2_clients') |
|
| 28 | ->onUpdate('cascade') |
|
| 29 | ->onDelete('cascade'); |
|
| 30 | ||
| 31 | $table->string('redirect_uri'); |
|
| 32 | $table->dateTime('expires_at'); |
|
| 33 | $table->timestamps(); |
|
| 34 | }); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Reverse the migrations. |
|
| 39 | * |
|
| 40 | * @return void |
|
| 41 | */ |
|
| 42 | public function down() |
|
| 43 | { |
|
| 44 | Schema::drop('oauth2_auth_codes'); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| @@ 7-46 (lines=40) @@ | ||
| 4 | use Illuminate\Database\Migrations\Migration; |
|
| 5 | use Illuminate\Support\Facades\Schema; |
|
| 6 | ||
| 7 | class CreateOAuthAccessTokensTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('oauth2_access_tokens', function(Blueprint $table) { |
|
| 17 | $table->char('id', 80)->primary(); |
|
| 18 | $table->char('user_id', 36)->nullable(); |
|
| 19 | $table->char('client_id', 36); |
|
| 20 | ||
| 21 | $table->foreign('user_id') |
|
| 22 | ->references('id')->on('oauth2_users') |
|
| 23 | ->onUpdate('cascade') |
|
| 24 | ->onDelete('cascade'); |
|
| 25 | ||
| 26 | $table->foreign('client_id') |
|
| 27 | ->references('id')->on('oauth2_clients') |
|
| 28 | ->onUpdate('cascade') |
|
| 29 | ->onDelete('cascade'); |
|
| 30 | ||
| 31 | $table->string('redirect_uri'); |
|
| 32 | $table->dateTime('expires_at'); |
|
| 33 | $table->timestamps(); |
|
| 34 | }); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Reverse the migrations. |
|
| 39 | * |
|
| 40 | * @return void |
|
| 41 | */ |
|
| 42 | public function down() |
|
| 43 | { |
|
| 44 | Schema::drop('oauth2_access_tokens'); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||