From b7cffbddd07447ff4b3d79c8f0907e513d8e5b8f Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 27 Jun 2022 19:05:57 +0200 Subject: [PATCH] CREATE INDEX IF NOT EXISTS is not supported as of MySQL <= 8.0, fixes #943 --- lib/Data/Database.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Data/Database.php b/lib/Data/Database.php index f9a8ae8a..a5b51362 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -837,8 +837,9 @@ class Database extends AbstractData end;' ); } else { + // CREATE INDEX IF NOT EXISTS not supported as of MySQL <= 8.0 self::$_db->exec( - 'CREATE INDEX IF NOT EXISTS "comment_parent" ON "' . + 'CREATE INDEX "comment_parent" ON "' . self::_sanitizeIdentifier('comment') . '" ("pasteid")' ); } @@ -949,8 +950,9 @@ class Database extends AbstractData self::_sanitizeIdentifier('comment') . '" ("dataid")' ); } + // CREATE INDEX IF NOT EXISTS not supported as of MySQL <= 8.0 self::$_db->exec( - 'CREATE INDEX IF NOT EXISTS "comment_parent" ON "' . + 'CREATE INDEX "comment_parent" ON "' . self::_sanitizeIdentifier('comment') . '" ("pasteid")' ); // no break, continue with updates for 0.22 and later