From 0a0acbb0ee84b62345f67824285a5240a4f156c2 Mon Sep 17 00:00:00 2001 From: Mykhailo Zuiev Date: Mon, 24 Jun 2024 14:33:40 +0200 Subject: [PATCH] feat(GfuKiQDV): unnecessary 'ALTER TABLE' without instructions in the end of SQL This leads to exception in Mysqli driver --- src/DataStore/src/TableGateway/TableManagerMysql.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/DataStore/src/TableGateway/TableManagerMysql.php b/src/DataStore/src/TableGateway/TableManagerMysql.php index 80933249..4deb67d0 100644 --- a/src/DataStore/src/TableGateway/TableManagerMysql.php +++ b/src/DataStore/src/TableGateway/TableManagerMysql.php @@ -405,9 +405,9 @@ public function getTableConfig($tableConfig) */ protected function create($tableName, $tableConfig = null) { - $tableConfig = is_null($tableConfig) ? $tableConfig = $tableName : $tableConfig; + $tableConfig = is_null($tableConfig) ? $tableName : $tableConfig; $createTable = $this->createCreateTable($tableName, $this->getTableConfig($tableConfig)); - $sql = $this->getCreateTableSql($createTable, $tableName); + $sql = $this->getCreateTableSql($createTable); return $this->db->query($sql, Adapter\Adapter::QUERY_MODE_EXECUTE); } @@ -452,7 +452,7 @@ protected function createCreateTable(string $tableName, array $tableConfig): Cre return $createTable; } - protected function getCreateTableSql(CreateTable $createTable, string $tableName): string + protected function getCreateTableSql(CreateTable $createTable): string { $createTableDecorator = new Sql\Platform\Mysql\Ddl\CreateTableDecorator(); $mySqlPlatformDbAdapter = new Adapter\Platform\Mysql(); @@ -463,11 +463,7 @@ protected function getCreateTableSql(CreateTable $createTable, string $tableName $sqlCreateTable = $createTableDecorator->setSubject($createTable) ->getSqlString($mySqlPlatformDbAdapter); - $mySqlPlatformSql = new Sql\Platform\Mysql\Mysql(); - $sql = new Sql\Sql($this->db, null, $mySqlPlatformSql); - $sqlAlterTable = $sql->buildSqlString(new AlterTable($tableName)); - - return "{$sqlCreateTable};" . PHP_EOL . "{$sqlAlterTable};"; + return "$sqlCreateTable;" . PHP_EOL; } /**