From 5dd0a07806da56ce3cae7c7142df46d4b3012048 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sun, 15 Sep 2024 22:28:04 -0400 Subject: [PATCH] Fix compatibility break from phinx getAdapterType() should have a consistent return with phinx. Fixes #747 --- src/Db/Adapter/PostgresAdapter.php | 14 ++++++++++++++ tests/TestCase/Db/Adapter/PostgresAdapterTest.php | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/Db/Adapter/PostgresAdapter.php b/src/Db/Adapter/PostgresAdapter.php index 47f357e5..71495597 100644 --- a/src/Db/Adapter/PostgresAdapter.php +++ b/src/Db/Adapter/PostgresAdapter.php @@ -1614,4 +1614,18 @@ public function bulkinsert(Table $table, array $rows): void $connection->execute($sql, $vals); } } + + /** + * Get the adapter type name + * + * @return string + */ + public function getAdapterType(): string + { + // Hardcoded because the parent implementation + // reads an option that is based off of Database\Driver + // names which is postgres, but pgsql is required for + // compatibility. + return 'pgsql'; + } } diff --git a/tests/TestCase/Db/Adapter/PostgresAdapterTest.php b/tests/TestCase/Db/Adapter/PostgresAdapterTest.php index be354199..a084dbc5 100644 --- a/tests/TestCase/Db/Adapter/PostgresAdapterTest.php +++ b/tests/TestCase/Db/Adapter/PostgresAdapterTest.php @@ -104,6 +104,11 @@ private function usingPostgres10(): bool return version_compare($version, '10.0.0', '>='); } + public function testAdapterType() + { + $this->assertEquals('pgsql', $this->adapter->getAdapterType()); + } + public function testConnection() { $this->assertInstanceOf(Connection::class, $this->adapter->getConnection());