fix: db version check (#749)

resolve #742
This commit is contained in:
chenos 2022-08-17 23:11:56 +08:00 committed by GitHub
parent 9b47ba2251
commit 2a18967418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,14 +81,16 @@ class DatabaseVersion {
},
mysql: {
sql: 'select version() as version',
get: (v) => v,
get: (v) => {
const m = /([\d+\.]+)/.exec(v);
return m[0];
},
},
postgres: {
sql: 'select version() as version',
get: (v) => {
const keys = v.split(/\s|,/);
keys.shift();
return semver.minVersion(keys.shift()).version;
const m = /([\d+\.]+)/.exec(v);
return semver.minVersion(m[0]).version;
},
},
};