| @@ 7-40 (lines=34) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateOauthClientsTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 17 | increments('id'); |
|
| 18 | $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | $table->string('name'); |
|
| 20 | $table->string('secret', 100); |
|
| 21 | $table->text('redirect'); |
|
| 22 | $table->boolean('personal_access_client')->default(0); |
|
| 23 | $table->boolean('password_client')->default(0); |
|
| 24 | $table->boolean('revoked')->default(0); |
|
| 25 | $table->timestamps(); |
|
| 26 | ||
| 27 | $table->foreign('user_id')->references('id')->on('users'); |
|
| 28 | }); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Reverse the migrations. |
|
| 33 | * |
|
| 34 | * @return void |
|
| 35 | */ |
|
| 36 | public function down() |
|
| 37 | { |
|
| 38 | Schema::drop('oauth_clients'); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 7-38 (lines=32) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 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('oauth_auth_codes', function (Blueprint $table) { |
|
| 17 | $table->string('id', 100)->primary(); |
|
| 18 | $table->unsignedInteger('user_id'); |
|
| 19 | $table->unsignedInteger('client_id'); |
|
| 20 | $table->text('scopes')->nullable(); |
|
| 21 | $table->boolean('revoked'); |
|
| 22 | $table->dateTime('expires_at')->nullable(); |
|
| 23 | ||
| 24 | $table->foreign('user_id')->references('id')->on('users'); |
|
| 25 | $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 26 | }); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Reverse the migrations. |
|
| 31 | * |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function down() |
|
| 35 | { |
|
| 36 | Schema::drop('oauth_auth_codes'); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||