From 4065fb77da48ecd8d50b0a76bf8fa37265603742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 15 Apr 2023 00:49:02 +0200 Subject: [PATCH] Properly escape group table name in legacy DB migration for compatibility with MySQL 8 Fixes issue #271 --- migrations/Version20190902140506.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/Version20190902140506.php b/migrations/Version20190902140506.php index 9a4697fc..95c8619e 100644 --- a/migrations/Version20190902140506.php +++ b/migrations/Version20190902140506.php @@ -216,10 +216,10 @@ final class Version20190902140506 extends AbstractMultiPlatformMigration $this->addSql('CREATE INDEX IDX_C68C4459398D64AA ON pricedetails (id_currency)'); $this->addSql('CREATE INDEX IDX_C68C44594A01DDC7 ON pricedetails (orderdetails_id)'); $this->addSql('DROP INDEX pricedetails_orderdetails_id_k ON pricedetails'); - $this->addSql('DROP INDEX name ON groups'); - $this->addSql('ALTER TABLE groups ADD not_selectable TINYINT(1) NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE comment comment LONGTEXT NOT NULL, CHANGE perms_labels perms_labels INT NOT NULL, CHANGE last_modified last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL'); - $this->addSql('ALTER TABLE groups ADD CONSTRAINT FK_F06D3970727ACA70 FOREIGN KEY (parent_id) REFERENCES `groups` (id)'); - $this->addSql('CREATE INDEX IDX_F06D3970727ACA70 ON groups (parent_id)'); + $this->addSql('DROP INDEX name ON `groups`'); + $this->addSql('ALTER TABLE `groups` ADD not_selectable TINYINT(1) NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE comment comment LONGTEXT NOT NULL, CHANGE perms_labels perms_labels INT NOT NULL, CHANGE last_modified last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL'); + $this->addSql('ALTER TABLE `groups` ADD CONSTRAINT FK_F06D3970727ACA70 FOREIGN KEY (parent_id) REFERENCES `groups` (id)'); + $this->addSql('CREATE INDEX IDX_F06D3970727ACA70 ON `groups` (parent_id)'); //Fill empty timestamps with current date $tables = ['attachments', 'attachment_types', 'categories', 'devices', 'footprints', 'manufacturers',