From 17e2b234a0dc74319110800a82020d775c27f07f Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 6 Feb 2021 14:33:51 +0100 Subject: [PATCH] dataprovider: fix migration with old mysql versions Fixes #298 --- dataprovider/mysql.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dataprovider/mysql.go b/dataprovider/mysql.go index 1d49ae9f..bb871ee2 100644 --- a/dataprovider/mysql.go +++ b/dataprovider/mysql.go @@ -47,9 +47,9 @@ const ( mysqlV8SQL = "ALTER TABLE `{{folders}}` ADD COLUMN `name` varchar(255) NULL;" + "ALTER TABLE `{{folders}}` MODIFY `path` varchar(512) NULL;" + "ALTER TABLE `{{folders}}` DROP INDEX `path`;" + - "UPDATE `{{folders}}` f1 SET name = (SELECT CONCAT('folder',f2.id) FROM `{{folders}}` f2 WHERE f2.id = f1.id);" + + "UPDATE `{{folders}}` f1 SET name = CONCAT('folder',f1.id);" + "ALTER TABLE `{{folders}}` MODIFY `name` varchar(255) NOT NULL;" + - "ALTER TABLE `folders` ADD CONSTRAINT `name` UNIQUE (`name`);" + "ALTER TABLE `{{folders}}` ADD CONSTRAINT `name` UNIQUE (`name`);" mysqlV8DownSQL = "ALTER TABLE `{{folders}}` DROP COLUMN `name`;" + "ALTER TABLE `{{folders}}` MODIFY `path` varchar(512) NOT NULL;" + "ALTER TABLE `{{folders}}` ADD CONSTRAINT `path` UNIQUE (`path`);"