From c7f5f0ff94df5743167951f963adc166bde9c0f5 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 2 Mar 2022 13:40:42 +0100 Subject: [PATCH] fix: migration sql escape for rename tables --- src/Appwrite/Migration/Version/V12.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V12.php b/src/Appwrite/Migration/Version/V12.php index 835c11fb44..415aaf7713 100644 --- a/src/Appwrite/Migration/Version/V12.php +++ b/src/Appwrite/Migration/Version/V12.php @@ -80,7 +80,7 @@ class V12 extends Migration continue; } - $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDefaultDatabase()}`.`_project_{$projectId}_{$id}` RENAME TO `{$this->projectDB->getDefaultDatabase()}`.`_{$projectId}_{$id}`")->execute(); + $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDefaultDatabase()}`.`_project_{$projectId}_{$id}` RENAME TO `_{$projectId}_{$id}`")->execute(); $this->pdo->prepare("CREATE TABLE IF NOT EXISTS `{$this->projectDB->getDefaultDatabase()}`.`_{$projectId}_{$id}_perms` ( `_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `_type` VARCHAR(12) NOT NULL, @@ -388,7 +388,7 @@ class V12 extends Migration /** * Rename user's colletion table schema */ - $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDefaultDatabase()}`._project_{$projectId}_collection_{$id}` RENAME TO `{$this->projectDB->getDefaultDatabase()}`.`_{$projectId}_collection_{$internalId}`")->execute(); + $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDefaultDatabase()}`.`_project_{$projectId}_collection_{$id}` RENAME TO `_{$projectId}_collection_{$internalId}`")->execute(); $this->pdo->prepare("CREATE TABLE IF NOT EXISTS `{$this->projectDB->getDefaultDatabase()}`.`_{$projectId}_collection_{$internalId}_perms` ( `_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `_type` VARCHAR(12) NOT NULL,