From 54fbdff53b633e839ec951a07e988999ddf16611 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 24 Feb 2025 02:07:36 +0300 Subject: [PATCH 01/17] Added Laravel 12 support --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 21eeecd..90fae3d 100644 --- a/composer.json +++ b/composer.json @@ -40,16 +40,16 @@ "doctrine/dbal": "^3.0 || ^4.0", "dragon-code/contracts": "^2.15", "dragon-code/support": "^6.0", - "illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "illuminate/database": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0" + "illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "illuminate/database": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0" }, "require-dev": { "ext-pdo_mysql": "*", "ext-pdo_pgsql": "*", "mockery/mockery": "^1.0", - "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0", - "phpunit/phpunit": "^9.6 || ^10.0" + "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0 || ^12.0" }, "minimum-stability": "stable", "prefer-stable": true, @@ -80,4 +80,4 @@ ] } } -} \ No newline at end of file +} From 83bec6918676ae60e20ca6c8439dd45c5ced6f8f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 24 Feb 2025 02:08:58 +0300 Subject: [PATCH 02/17] Update phpunit.yml --- .github/workflows/phpunit.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 0a16a52..b856d2b 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -10,7 +10,7 @@ jobs: fail-fast: true matrix: php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] - laravel: [ "8.0", "9.0", "10.0", "11.0" ] + laravel: [ "8.0", "9.0", "10.0", "11.0", "12.0" ] psql: [ "9", "10", "11", "12", "13", "14", "15", "16", "17" ] exclude: - laravel: "8.0" @@ -42,6 +42,21 @@ jobs: - laravel: "11.0" psql: "11" + + - laravel: "12.0" + php: "8.0" + + - laravel: "12.0" + php: "8.1" + + - laravel: "12.0" + psql: "9" + + - laravel: "12.0" + psql: "10" + + - laravel: "12.0" + psql: "11" name: php ${{ matrix.php }}, lr ${{ matrix.laravel }}, pg ${{ matrix.psql }} From fd3297a690e9f25161964a8d10af19791c0ada3c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 24 Feb 2025 21:00:05 +0300 Subject: [PATCH 03/17] Update phpunit.xml --- phpunit.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 6317452..32b0da2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -18,11 +18,6 @@ ./src - - - - - From 7b9356f03f21cb32e1f4a9961fd36fd9e62737ba Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 25 Feb 2025 01:28:36 +0300 Subject: [PATCH 04/17] Fixed Laravel 12 compatibility --- README.md | 3 ++- tests/Connectors/MySqlConnection.php | 4 +++- tests/Connectors/PostgresConnection.php | 4 +++- tests/Connectors/SqlServerConnection.php | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0b61b1d..1ce4222 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda | Service | Versions | |:----------|:-----------------------------------| | PHP | ^8.0 | -| Laravel | ^8.0, ^9.0, ^10.0, ^11.0 | +| Laravel | ^8.0, ^9.0, ^10.0, ^11.0, ^12.0 | | Databases | MySQL 5.7+, PostgreSQL 9.5+, MSSQL | | Laravel \ PostgreSQL | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | @@ -40,6 +40,7 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda | 9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | 10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | 11 | ✖️ | ✖️ | ✖️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| 12 | ✖️ | ✖️ | ✖️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ## Usage diff --git a/tests/Connectors/MySqlConnection.php b/tests/Connectors/MySqlConnection.php index 694359a..3c931db 100644 --- a/tests/Connectors/MySqlConnection.php +++ b/tests/Connectors/MySqlConnection.php @@ -11,7 +11,9 @@ class MySqlConnection extends BaseConnection { protected function grammar(): Grammar { - return new MySqlGrammar(); + return new MySqlGrammar( + $this->databaseConnection() + ); } protected function connector(): ConnectorInterface diff --git a/tests/Connectors/PostgresConnection.php b/tests/Connectors/PostgresConnection.php index 2cc5134..baf0d52 100644 --- a/tests/Connectors/PostgresConnection.php +++ b/tests/Connectors/PostgresConnection.php @@ -28,7 +28,9 @@ protected function dropSessions(string $name): string protected function grammar(): Grammar { - return new PostgresGrammar(); + return new PostgresGrammar( + $this->databaseConnection() + ); } protected function connector(): ConnectorInterface diff --git a/tests/Connectors/SqlServerConnection.php b/tests/Connectors/SqlServerConnection.php index dc0129e..9e44f97 100644 --- a/tests/Connectors/SqlServerConnection.php +++ b/tests/Connectors/SqlServerConnection.php @@ -11,7 +11,9 @@ class SqlServerConnection extends BaseConnection { protected function grammar(): Grammar { - return new SqlServerGrammar(); + return new SqlServerGrammar( + $this->databaseConnection() + ); } protected function connector(): ConnectorInterface From 2d6cb268ee201c300914a8af0062cab5d539bc22 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 00:45:00 +0300 Subject: [PATCH 05/17] Update phpunit.xml --- phpunit.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 32b0da2..68760ac 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,14 +19,14 @@ ./src - - - - - ./tests + + + + + From ae7abb6136c37e5fc3e8dc6a4a76a6e61afe5f2e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 02:26:52 +0300 Subject: [PATCH 06/17] Update phpunit.yml --- .github/workflows/phpunit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b856d2b..fb424a4 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -57,6 +57,9 @@ jobs: - laravel: "12.0" psql: "11" + + - laravel: "12.0" + psql: "12" name: php ${{ matrix.php }}, lr ${{ matrix.laravel }}, pg ${{ matrix.psql }} From b10837e72beb928f545079e13ecaa2740b94466b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 02:41:21 +0300 Subject: [PATCH 07/17] Update phpunit.yml --- .github/workflows/phpunit.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index fb424a4..b856d2b 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -57,9 +57,6 @@ jobs: - laravel: "12.0" psql: "11" - - - laravel: "12.0" - psql: "12" name: php ${{ matrix.php }}, lr ${{ matrix.laravel }}, pg ${{ matrix.psql }} From e724cd91619ee13e3e7db643248f5f2b03feff53 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 02:45:27 +0300 Subject: [PATCH 08/17] Update Migrate.php --- src/Console/Migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index da6a82f..d9dcc63 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -137,7 +137,7 @@ protected function migrateTable(string $table, string $column): void ->chunk(1000, function (Collection $items) use ($table) { $items = Arr::resolve($items); - $this->builder($this->target(), $table)->insert($items); + $this->builder($this->target(), $table)->insertOrIgnore($items); }); $this->migrated[] = $table; From 3fe231cdaf88a1b761340b6aac8fcf358351d9df Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:05:28 +0300 Subject: [PATCH 09/17] Try to fix with Laravel 12 compatibility --- composer.json | 5 ++++- src/Console/Migrate.php | 14 +++++++------- tests/Concerns/Seeders.php | 17 ++++++++++++++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 90fae3d..06cda48 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,6 @@ "require": { "php": "^8.0", "ext-pdo": "*", - "doctrine/dbal": "^3.0 || ^4.0", "dragon-code/contracts": "^2.15", "dragon-code/support": "^6.0", "illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", @@ -47,10 +46,14 @@ "require-dev": { "ext-pdo_mysql": "*", "ext-pdo_pgsql": "*", + "doctrine/dbal": "^3.0 || ^4.0", "mockery/mockery": "^1.0", "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0 || ^12.0" }, + "suggest": { + "doctrine/dbal": "[For Laravel 8-10] Required to rename columns and drop SQLite columns (^3.5.1)." + }, "minimum-stability": "stable", "prefer-stable": true, "autoload": { diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index d9dcc63..9e476c1 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -17,10 +17,10 @@ class Migrate extends Command { protected $signature = 'db:migrate' - . ' {--schema-from= : Source connection name}' - . ' {--schema-to= : Target connection name}' - . ' {--exclude=* : Comma separated table names to exclude}' - . ' {--tables=* : Comma separated table names to migrate only}'; + . ' {--schema-from= : Source connection name}' + . ' {--schema-to= : Target connection name}' + . ' {--exclude=* : Comma separated table names to exclude}' + . ' {--tables=* : Comma separated table names to migrate only}'; protected $description = 'Data transfer from one database to another'; @@ -135,9 +135,9 @@ protected function migrateTable(string $table, string $column): void $this->builder($this->source(), $table) ->orderBy($column) ->chunk(1000, function (Collection $items) use ($table) { - $items = Arr::resolve($items); - - $this->builder($this->target(), $table)->insertOrIgnore($items); + $this->builder($this->target(), $table)->updateOrInsert( + Arr::resolve($items) + ); }); $this->migrated[] = $table; diff --git a/tests/Concerns/Seeders.php b/tests/Concerns/Seeders.php index 435b637..d73dc44 100644 --- a/tests/Concerns/Seeders.php +++ b/tests/Concerns/Seeders.php @@ -2,6 +2,7 @@ namespace Tests\Concerns; +use Illuminate\Foundation\Application; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; @@ -33,10 +34,20 @@ protected function fillTable(string $table): void protected function fillUlidTable(string $table): void { + $ulids = []; + + for ($i = 0; $i < 3; $i++) { + $ulids[$i] = (string) Str::ulid(); + + if (Str::startsWith(Application::VERSION, '12.')) { + usleep(500); + } + } + DB::connection($this->source_connection)->table($table)->insert([ - ['value' => $table . '_1', 'ulid' => (string) Str::ulid()], - ['value' => $table . '_2', 'ulid' => (string) Str::ulid()], - ['value' => $table . '_3', 'ulid' => (string) Str::ulid()], + ['value' => $table . '_1', 'ulid' => $ulids[0]], + ['value' => $table . '_2', 'ulid' => $ulids[1]], + ['value' => $table . '_3', 'ulid' => $ulids[2]], ]); } From e62fc92be96547f2cd772c941fc4f448e9e07b0a Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:08:12 +0300 Subject: [PATCH 10/17] Try to fix with Laravel 12 compatibility --- .github/workflows/phpunit.yml | 2 +- src/Console/Migrate.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b856d2b..14efe50 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,6 +1,6 @@ name: phpunit -on: [ push, pull_request ] +on: [ push ] jobs: build: diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index 9e476c1..fc14b41 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -135,9 +135,9 @@ protected function migrateTable(string $table, string $column): void $this->builder($this->source(), $table) ->orderBy($column) ->chunk(1000, function (Collection $items) use ($table) { - $this->builder($this->target(), $table)->updateOrInsert( - Arr::resolve($items) - ); + $items = Arr::resolve($items); + + $this->builder($this->target(), $table)->insert($items); }); $this->migrated[] = $table; From d96f5cc94efbb01e0305544417a042e26b504e98 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:12:34 +0300 Subject: [PATCH 11/17] Try to fix with Laravel 12 compatibility --- composer.json | 2 +- tests/Concerns/Seeders.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 06cda48..74444fb 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "doctrine/dbal": "^3.0 || ^4.0", "mockery/mockery": "^1.0", "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", - "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0 || ^12.0" + "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0" }, "suggest": { "doctrine/dbal": "[For Laravel 8-10] Required to rename columns and drop SQLite columns (^3.5.1)." diff --git a/tests/Concerns/Seeders.php b/tests/Concerns/Seeders.php index d73dc44..9a53786 100644 --- a/tests/Concerns/Seeders.php +++ b/tests/Concerns/Seeders.php @@ -40,7 +40,7 @@ protected function fillUlidTable(string $table): void $ulids[$i] = (string) Str::ulid(); if (Str::startsWith(Application::VERSION, '12.')) { - usleep(500); + usleep(1100); } } From fb0f6c78246be2c2f83bc29b3a0d4a7783de3688 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:22:21 +0300 Subject: [PATCH 12/17] Try to fix with Laravel 12 compatibility --- tests/Concerns/Database.php | 4 ++++ tests/Concerns/Seeders.php | 16 +++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/Concerns/Database.php b/tests/Concerns/Database.php index 805dbbc..a887a3f 100644 --- a/tests/Concerns/Database.php +++ b/tests/Concerns/Database.php @@ -101,6 +101,10 @@ protected function runMigrations(): void protected function getTables(SchemaBuilder $builder): array { + if (method_exists($builder, 'getTableListing')) { + return $builder->getTableListing(); + } + return method_exists($builder, 'getAllTables') ? $builder->getAllTables() : $builder->getTables(); diff --git a/tests/Concerns/Seeders.php b/tests/Concerns/Seeders.php index 9a53786..75a5497 100644 --- a/tests/Concerns/Seeders.php +++ b/tests/Concerns/Seeders.php @@ -34,20 +34,10 @@ protected function fillTable(string $table): void protected function fillUlidTable(string $table): void { - $ulids = []; - - for ($i = 0; $i < 3; $i++) { - $ulids[$i] = (string) Str::ulid(); - - if (Str::startsWith(Application::VERSION, '12.')) { - usleep(1100); - } - } - DB::connection($this->source_connection)->table($table)->insert([ - ['value' => $table . '_1', 'ulid' => $ulids[0]], - ['value' => $table . '_2', 'ulid' => $ulids[1]], - ['value' => $table . '_3', 'ulid' => $ulids[2]], + ['value' => $table . '_1', 'ulid' => (string) Str::ulid()], + ['value' => $table . '_2', 'ulid' => (string) Str::ulid()], + ['value' => $table . '_3', 'ulid' => (string) Str::ulid()], ]); } From 38e773f08c6218e144b6ab0cfc18e3bae69a1363 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:24:53 +0300 Subject: [PATCH 13/17] Fixed code-style --- src/Console/Migrate.php | 10 ++++++---- src/Constants/Drivers.php | 2 ++ src/Database/Builder.php | 2 ++ src/Database/Manager.php | 2 ++ src/Database/MySQLBuilder.php | 2 ++ src/Database/PostgresBuilder.php | 2 ++ src/Database/SqlServerBuilder.php | 2 ++ src/Exceptions/InvalidArgumentException.php | 2 ++ src/Facades/BuilderManager.php | 2 ++ src/ServiceProvider.php | 2 ++ tests/Concerns/Connections.php | 2 ++ tests/Concerns/Database.php | 2 ++ tests/Concerns/Migration.php | 2 ++ tests/Concerns/Seeders.php | 3 ++- tests/Configurations/BaseConfiguration.php | 2 ++ tests/Configurations/Configuration.php | 2 ++ tests/Configurations/Manager.php | 2 ++ tests/Configurations/MySQL.php | 2 ++ tests/Configurations/Postgres.php | 2 ++ tests/Configurations/SqlServer.php | 2 ++ tests/Connectors/BaseConnection.php | 2 ++ tests/Connectors/MySqlConnection.php | 2 ++ tests/Connectors/PostgresConnection.php | 2 ++ tests/Connectors/SqlServerConnection.php | 2 ++ tests/Providers/TestServiceProvider.php | 2 ++ tests/TestCase.php | 2 ++ tests/Unit/MysqlToMysqlTest.php | 2 ++ tests/Unit/MysqlToPostgresTest.php | 2 ++ tests/Unit/PostgresToMysqlTest.php | 2 ++ tests/Unit/PostgresToPostgresTest.php | 2 ++ .../migrations/2021_02_11_153247_create_foo_table.php | 2 ++ .../migrations/2021_02_11_153324_create_bar_table.php | 2 ++ .../migrations/2021_02_11_153348_create_baz_table.php | 2 ++ .../2023_12_15_014834_create_ulid_primary_key.php | 2 ++ .../2023_12_15_014834_create_uuid_primary_key.php | 2 ++ 35 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index fc14b41..eec6d46 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -1,5 +1,7 @@ Date: Thu, 27 Mar 2025 12:32:52 +0300 Subject: [PATCH 14/17] Try to fix with Laravel 12 compatibility --- tests/Concerns/Database.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/Concerns/Database.php b/tests/Concerns/Database.php index 8325f82..0201fcc 100644 --- a/tests/Concerns/Database.php +++ b/tests/Concerns/Database.php @@ -103,12 +103,8 @@ protected function runMigrations(): void protected function getTables(SchemaBuilder $builder): array { - if (method_exists($builder, 'getTableListing')) { - return $builder->getTableListing(); - } - return method_exists($builder, 'getAllTables') ? $builder->getAllTables() - : $builder->getTables(); + : $builder->getTables($builder->getCurrentSchemaName()); } } From 8fd5ac05b8a2c07f726ec167d4d9c17b659a5085 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:37:59 +0300 Subject: [PATCH 15/17] Try to fix with Laravel 12 compatibility --- src/Console/Migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index eec6d46..9151fc3 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -139,7 +139,7 @@ protected function migrateTable(string $table, string $column): void ->chunk(1000, function (Collection $items) use ($table) { $items = Arr::resolve($items); - $this->builder($this->target(), $table)->insert($items); + $this->builder($this->target(), $table)->insertOrIgnore($items); }); $this->migrated[] = $table; From b598b4957684e9133d6ff662041dd7bce341e582 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:53:10 +0300 Subject: [PATCH 16/17] Try to fix with Laravel 12 compatibility --- src/Console/Migrate.php | 6 +++--- src/Database/Builder.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index 9151fc3..e031607 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -137,9 +137,9 @@ protected function migrateTable(string $table, string $column): void $this->builder($this->source(), $table) ->orderBy($column) ->chunk(1000, function (Collection $items) use ($table) { - $items = Arr::resolve($items); - - $this->builder($this->target(), $table)->insertOrIgnore($items); + $this->builder($this->target(), $table)->insert( + Arr::resolve($items) + ); }); $this->migrated[] = $table; diff --git a/src/Database/Builder.php b/src/Database/Builder.php index ccfe0c2..7cb0196 100644 --- a/src/Database/Builder.php +++ b/src/Database/Builder.php @@ -37,7 +37,7 @@ public function getAllTables(): array { $tables = method_exists($this->schema(), 'getAllTables') ? $this->schema()->getAllTables() - : $this->schema()->getTables(); + : $this->schema()->getTables($this->schema()->getCurrentSchemaName()); $key = $this->tableNameColumn(); From 5c291437cd0279a2b86f643908ca47f15fee87b9 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 27 Mar 2025 12:58:29 +0300 Subject: [PATCH 17/17] Try to fix with Laravel 12 compatibility --- src/Database/Builder.php | 6 +++++- tests/Concerns/Database.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Database/Builder.php b/src/Database/Builder.php index 7cb0196..ed47870 100644 --- a/src/Database/Builder.php +++ b/src/Database/Builder.php @@ -35,9 +35,13 @@ public function schema(): SchemaBuilder public function getAllTables(): array { + $schema = method_exists($this->schema(), 'getCurrentSchemaName') + ? $this->schema()->getCurrentSchemaName() + : null; + $tables = method_exists($this->schema(), 'getAllTables') ? $this->schema()->getAllTables() - : $this->schema()->getTables($this->schema()->getCurrentSchemaName()); + : $this->schema()->getTables($schema); $key = $this->tableNameColumn(); diff --git a/tests/Concerns/Database.php b/tests/Concerns/Database.php index 0201fcc..469c4ba 100644 --- a/tests/Concerns/Database.php +++ b/tests/Concerns/Database.php @@ -103,8 +103,12 @@ protected function runMigrations(): void protected function getTables(SchemaBuilder $builder): array { + $schema = method_exists($builder, 'getCurrentSchemaName') + ? $builder->getCurrentSchemaName() + : null; + return method_exists($builder, 'getAllTables') ? $builder->getAllTables() - : $builder->getTables($builder->getCurrentSchemaName()); + : $builder->getTables($schema); } }