浏览代码

scripts/mysql: fix compatibility issue (#5786)

Shiki-H 5 年之前
父节点
当前提交
2f0cdfd564
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      scripts/mysql.sql

+ 9 - 3
scripts/mysql.sql

@@ -1,5 +1,11 @@
-SET GLOBAL innodb_file_per_table = ON,
-           innodb_file_format = Barracuda,
-           innodb_large_prefix = ON;
+SET @s = IF(version() < 8 OR version() LIKE '%MariaDB%', 
+            'SET GLOBAL innodb_file_per_table = ON, 
+                        innodb_file_format = Barracuda, 
+                        innodb_large_prefix = ON;', 
+            'SET GLOBAL innodb_file_per_table = ON;');
+PREPARE stmt1 FROM @s;
+EXECUTE stmt1; 
+
 DROP DATABASE IF EXISTS gogs;
 CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
+