Skip to content

Commit 4bfdb96

Browse files
[10.x] Fix migrations for Laravel 9.x (#1639)
* fix migrations * style fix * style fix
1 parent 75fd509 commit 4bfdb96

5 files changed

+35
-100
lines changed

database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration
7+
return new class() extends Migration
88
{
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-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_auth_codes', function (Blueprint $table) {
16+
$schema = Schema::connection($this->getConnection());
17+
18+
$schema->create('oauth_auth_codes', function (Blueprint $table) {
3419
$table->string('id', 100)->primary();
3520
$table->unsignedBigInteger('user_id')->index();
3621
$table->unsignedBigInteger('client_id');
@@ -47,7 +32,9 @@ public function up()
4732
*/
4833
public function down()
4934
{
50-
$this->schema->dropIfExists('oauth_auth_codes');
35+
$schema = Schema::connection($this->getConnection());
36+
37+
$schema->dropIfExists('oauth_auth_codes');
5138
}
5239

5340
/**

database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration
7+
return new class() extends Migration
88
{
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-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_access_tokens', function (Blueprint $table) {
16+
$schema = Schema::connection($this->getConnection());
17+
18+
$schema->create('oauth_access_tokens', function (Blueprint $table) {
3419
$table->string('id', 100)->primary();
3520
$table->unsignedBigInteger('user_id')->nullable()->index();
3621
$table->unsignedBigInteger('client_id');
@@ -49,7 +34,9 @@ public function up()
4934
*/
5035
public function down()
5136
{
52-
$this->schema->dropIfExists('oauth_access_tokens');
37+
$schema = Schema::connection($this->getConnection());
38+
39+
$schema->dropIfExists('oauth_access_tokens');
5340
}
5441

5542
/**

database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration
7+
return new class() extends Migration
88
{
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-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_refresh_tokens', function (Blueprint $table) {
16+
$schema = Schema::connection($this->getConnection());
17+
18+
$schema->create('oauth_refresh_tokens', function (Blueprint $table) {
3419
$table->string('id', 100)->primary();
3520
$table->string('access_token_id', 100)->index();
3621
$table->boolean('revoked');
@@ -45,7 +30,9 @@ public function up()
4530
*/
4631
public function down()
4732
{
48-
$this->schema->dropIfExists('oauth_refresh_tokens');
33+
$schema = Schema::connection($this->getConnection());
34+
35+
$schema->dropIfExists('oauth_refresh_tokens');
4936
}
5037

5138
/**

database/migrations/2016_06_01_000004_create_oauth_clients_table.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,8 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration
7+
return new class() extends Migration
88
{
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-
269
/**
2710
* Get the migration connection name.
2811
*
@@ -40,7 +23,9 @@ public function getConnection()
4023
*/
4124
public function up()
4225
{
43-
$this->schema->create('oauth_clients', function (Blueprint $table) {
26+
$schema = Schema::connection($this->getConnection());
27+
28+
$schema->create('oauth_clients', function (Blueprint $table) {
4429
$table->bigIncrements('id');
4530
$table->unsignedBigInteger('user_id')->nullable()->index();
4631
$table->string('name');
@@ -61,6 +46,8 @@ public function up()
6146
*/
6247
public function down()
6348
{
64-
$this->schema->dropIfExists('oauth_clients');
49+
$schema = Schema::connection($this->getConnection());
50+
51+
$schema->dropIfExists('oauth_clients');
6552
}
6653
};

database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration
7+
return new class() extends Migration
88
{
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-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_personal_access_clients', function (Blueprint $table) {
16+
$schema = Schema::connection($this->getConnection());
17+
18+
$schema->create('oauth_personal_access_clients', function (Blueprint $table) {
3419
$table->bigIncrements('id');
3520
$table->unsignedBigInteger('client_id');
3621
$table->timestamps();
@@ -44,7 +29,9 @@ public function up()
4429
*/
4530
public function down()
4631
{
47-
$this->schema->dropIfExists('oauth_personal_access_clients');
32+
$schema = Schema::connection($this->getConnection());
33+
34+
$schema->dropIfExists('oauth_personal_access_clients');
4835
}
4936

5037
/**

0 commit comments

Comments
 (0)