diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2b713bf8..ac83eabe2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: n=$((n+1)) sleep 2 done - mysql -h 127.0.0.1 -u root -proot -D phinx -e 'SELECT 1;' + mysql -h 127.0.0.1 -u root -proot -D phinx -e 'SELECT 1' fi if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then psql -c 'CREATE DATABASE phinx;' postgresql://postgres:postgres@127.0.0.1; fi diff --git a/src/Phinx/Db/Adapter/PdoAdapter.php b/src/Phinx/Db/Adapter/PdoAdapter.php index f30af3252..28997e9b5 100644 --- a/src/Phinx/Db/Adapter/PdoAdapter.php +++ b/src/Phinx/Db/Adapter/PdoAdapter.php @@ -197,8 +197,8 @@ abstract public function disconnect(): void; */ public function execute(string $sql, array $params = []): int { - $sql = rtrim($sql, "; \t\n\r\0\x0B") . ';'; - $this->verboseLog($sql); + $sql = rtrim($sql, "; \t\n\r\0\x0B"); + $this->verboseLog($sql . ';'); if ($this->isDryRunEnabled()) { return 0; diff --git a/tests/Phinx/Db/Adapter/PdoAdapterTest.php b/tests/Phinx/Db/Adapter/PdoAdapterTest.php index e00c0968e..b977db70c 100644 --- a/tests/Phinx/Db/Adapter/PdoAdapterTest.php +++ b/tests/Phinx/Db/Adapter/PdoAdapterTest.php @@ -188,7 +188,7 @@ public function testExecuteCanBeCalled() { /** @var \PDO&\PHPUnit\Framework\MockObject\MockObject $pdo */ $pdo = $this->getMockBuilder(PDO::class)->disableOriginalConstructor()->onlyMethods(['exec'])->getMock(); - $pdo->expects($this->once())->method('exec')->with('SELECT 1;')->will($this->returnValue(1)); + $pdo->expects($this->once())->method('exec')->with('SELECT 1')->will($this->returnValue(1)); $this->adapter->setConnection($pdo); $this->adapter->execute('SELECT 1'); @@ -198,7 +198,7 @@ public function testExecuteRightTrimsSemiColons() { /** @var \PDO&\PHPUnit\Framework\MockObject\MockObject $pdo */ $pdo = $this->getMockBuilder(PDO::class)->disableOriginalConstructor()->onlyMethods(['exec'])->getMock(); - $pdo->expects($this->once())->method('exec')->with('SELECT 1;')->will($this->returnValue(1)); + $pdo->expects($this->once())->method('exec')->with('SELECT 1')->will($this->returnValue(1)); $this->adapter->setConnection($pdo); $this->adapter->execute('SELECT 1;;');