Skip to content

Commit 728e21c

Browse files
move unsupported MySQL check inside downloaded binary if statement (#166)
1 parent db2efe2 commit 728e21c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ export async function createDB(opts?: ServerOptions) {
4949
throw `A version of MySQL is installed on your system that is not supported by this package. If you want to download a MySQL binary instead of getting this error, please set the option "ignoreUnsupportedSystemVersion" to true.`
5050
}
5151

52-
if (options.version && lt(options.version, MIN_SUPPORTED_MYSQL)) {
53-
//The difference between the throw here and the throw above is this throw is because the selected "version" is not supported.
54-
//The throw above is because the system-installed MySQL is out of date and "ignoreUnsupportedSystemVersion" is not set to true.
55-
throw `The selected version of MySQL (${options.version}) is not currently supported by this package. Please choose a different version to use.`
56-
}
57-
5852
logger.log('Version currently installed:', version)
5953
if (version === null || (options.version && !satisfies(version.version, options.version)) || unsupportedMySQLIsInstalled) {
6054
let binaryInfo: BinaryInfo;
@@ -70,6 +64,12 @@ export async function createDB(opts?: ServerOptions) {
7064
throw `A MySQL binary could not be found that supports your OS (${os.platform()} | ${os.version()} | ${os.release()}) and CPU architecture (${os.arch()}). Please check you have the latest version of mysql-memory-server. If the latest version still doesn't support your OS and CPU architecture, feel free to make a pull request to add support!`
7165
}
7266

67+
if (lt(binaryInfo.version, MIN_SUPPORTED_MYSQL)) {
68+
//The difference between the throw here and the throw above is this throw is because the selected "version" is not supported.
69+
//The throw above is because the system-installed MySQL is out of date and "ignoreUnsupportedSystemVersion" is not set to true.
70+
throw `The selected version of MySQL (${options.version}) is not currently supported by this package. Please choose a different version to use.`
71+
}
72+
7373
try {
7474
binaryFilepath = await downloadBinary(binaryInfo, options, logger);
7575
} catch (error) {

0 commit comments

Comments
 (0)