1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00

Support MySQL 8.x series

Two issues resolved relating to MySQL 8:

1. DB version checking skips MINOR/PATCH checks if MAJOR release changed.
2. Keyword 'admin' quoted to ensure MySQL compat.

Closes #152
This commit is contained in:
sauls8t 2018-05-10 15:14:50 +01:00
parent 0f87d5b07e
commit 2066f72258
7 changed files with 700 additions and 673 deletions

View file

@ -77,6 +77,10 @@ func Check(runtime *env.Runtime) bool {
}
for k, v := range verInts {
// If major release is higher then skip minor/patch checks (e.g. 8.x.x > 5.x.x)
if k == 0 && len(verNums) > 0 && verNums[0] > verInts[0] {
break
}
if verNums[k] < v {
want := fmt.Sprintf("%d.%d.%d", verInts[0], verInts[1], verInts[2])
runtime.Log.Error("MySQL version element "+strconv.Itoa(k+1)+" of '"+version+"' not high enough, need at least version "+want, errors.New("bad MySQL version"))

View file

@ -153,7 +153,7 @@ func setupAccount(rt *env.Runtime, completion onboardRequest, serial string) (er
// Link user to organization.
accountID := uniqueid.Generate()
sql = fmt.Sprintf("insert into account (refid, userid, orgid, admin, editor) values (\"%s\", \"%s\", \"%s\",1, 1)", accountID, userID, orgID)
sql = fmt.Sprintf("insert into account (refid, userid, orgid, `admin`, editor) values (\"%s\", \"%s\", \"%s\",1, 1)", accountID, userID, orgID)
_, err = runSQL(rt, sql)
if err != nil {

View file

@ -13,6 +13,6 @@ ALTER TABLE useractivity ADD COLUMN `metadata` VARCHAR(1000) NOT NULL DEFAULT ''
-- new role for viewing content analytics
ALTER TABLE account ADD COLUMN `analytics` BOOL NOT NULL DEFAULT 0 AFTER `users`;
UPDATE account SET analytics=1 WHERE admin=1;
UPDATE account SET analytics=1 WHERE `admin`=1;
-- deprecations