@@ 7-64 (lines=58) @@ | ||
4 | use Illuminate\Database\Schema\Blueprint; |
|
5 | use Illuminate\Support\Facades\Schema; |
|
6 | ||
7 | class CreateOauthAccessTokensTable extends Migration |
|
8 | { |
|
9 | /** |
|
10 | * The database schema. |
|
11 | * |
|
12 | * @var \Illuminate\Database\Schema\Builder |
|
13 | */ |
|
14 | protected $schema; |
|
15 | ||
16 | /** |
|
17 | * Create a new migration instance. |
|
18 | * |
|
19 | * @return void |
|
20 | */ |
|
21 | public function __construct() |
|
22 | { |
|
23 | $this->schema = Schema::connection($this->getConnection()); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * Run the migrations. |
|
28 | * |
|
29 | * @return void |
|
30 | */ |
|
31 | public function up() |
|
32 | { |
|
33 | $this->schema->create('oauth_access_tokens', function (Blueprint $table) { |
|
34 | $table->string('id', 100)->primary(); |
|
35 | $table->unsignedBigInteger('user_id')->nullable()->index(); |
|
36 | $table->unsignedBigInteger('client_id'); |
|
37 | $table->string('name')->nullable(); |
|
38 | $table->text('scopes')->nullable(); |
|
39 | $table->boolean('revoked'); |
|
40 | $table->timestamps(); |
|
41 | $table->dateTime('expires_at')->nullable(); |
|
42 | }); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * Reverse the migrations. |
|
47 | * |
|
48 | * @return void |
|
49 | */ |
|
50 | public function down() |
|
51 | { |
|
52 | $this->schema->dropIfExists('oauth_access_tokens'); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * Get the migration connection name. |
|
57 | * |
|
58 | * @return string|null |
|
59 | */ |
|
60 | public function getConnection() |
|
61 | { |
|
62 | return config('passport.storage.database.connection'); |
|
63 | } |
|
64 | } |
|
65 |
@@ 7-66 (lines=60) @@ | ||
4 | use Illuminate\Database\Schema\Blueprint; |
|
5 | use Illuminate\Support\Facades\Schema; |
|
6 | ||
7 | class CreateOauthClientsTable extends Migration |
|
8 | { |
|
9 | /** |
|
10 | * The database schema. |
|
11 | * |
|
12 | * @var \Illuminate\Database\Schema\Builder |
|
13 | */ |
|
14 | protected $schema; |
|
15 | ||
16 | /** |
|
17 | * Create a new migration instance. |
|
18 | * |
|
19 | * @return void |
|
20 | */ |
|
21 | public function __construct() |
|
22 | { |
|
23 | $this->schema = Schema::connection($this->getConnection()); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * Get the migration connection name. |
|
28 | * |
|
29 | * @return string|null |
|
30 | */ |
|
31 | public function getConnection() |
|
32 | { |
|
33 | return config('passport.storage.database.connection'); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * Run the migrations. |
|
38 | * |
|
39 | * @return void |
|
40 | */ |
|
41 | public function up() |
|
42 | { |
|
43 | $this->schema->create('oauth_clients', function (Blueprint $table) { |
|
44 | $table->bigIncrements('id'); |
|
45 | $table->unsignedBigInteger('user_id')->nullable()->index(); |
|
46 | $table->string('name'); |
|
47 | $table->string('secret', 100)->nullable(); |
|
48 | $table->string('provider')->nullable(); |
|
49 | $table->text('redirect'); |
|
50 | $table->boolean('personal_access_client'); |
|
51 | $table->boolean('password_client'); |
|
52 | $table->boolean('revoked'); |
|
53 | $table->timestamps(); |
|
54 | }); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Reverse the migrations. |
|
59 | * |
|
60 | * @return void |
|
61 | */ |
|
62 | public function down() |
|
63 | { |
|
64 | $this->schema->dropIfExists('oauth_clients'); |
|
65 | } |
|
66 | } |
|
67 |