CREATE INDEX IF NOT EXISTS is not supported as of MySQL <= 8.0, fixes #943

This commit is contained in:
El RIDO 2022-06-27 19:05:57 +02:00
parent 9b132f4054
commit b7cffbddd0
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

View File

@ -837,8 +837,9 @@ class Database extends AbstractData
end;' end;'
); );
} else { } else {
// CREATE INDEX IF NOT EXISTS not supported as of MySQL <= 8.0
self::$_db->exec( self::$_db->exec(
'CREATE INDEX IF NOT EXISTS "comment_parent" ON "' . 'CREATE INDEX "comment_parent" ON "' .
self::_sanitizeIdentifier('comment') . '" ("pasteid")' self::_sanitizeIdentifier('comment') . '" ("pasteid")'
); );
} }
@ -949,8 +950,9 @@ class Database extends AbstractData
self::_sanitizeIdentifier('comment') . '" ("dataid")' self::_sanitizeIdentifier('comment') . '" ("dataid")'
); );
} }
// CREATE INDEX IF NOT EXISTS not supported as of MySQL <= 8.0
self::$_db->exec( self::$_db->exec(
'CREATE INDEX IF NOT EXISTS "comment_parent" ON "' . 'CREATE INDEX "comment_parent" ON "' .
self::_sanitizeIdentifier('comment') . '" ("pasteid")' self::_sanitizeIdentifier('comment') . '" ("pasteid")'
); );
// no break, continue with updates for 0.22 and later // no break, continue with updates for 0.22 and later