Skip to content

Commit

Permalink
move unsupported MySQL check inside downloaded binary if statement (#166
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Sebastian-Webster authored Dec 5, 2024
1 parent db2efe2 commit 728e21c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ export async function createDB(opts?: ServerOptions) {
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.`
}

if (options.version && lt(options.version, MIN_SUPPORTED_MYSQL)) {
//The difference between the throw here and the throw above is this throw is because the selected "version" is not supported.
//The throw above is because the system-installed MySQL is out of date and "ignoreUnsupportedSystemVersion" is not set to true.
throw `The selected version of MySQL (${options.version}) is not currently supported by this package. Please choose a different version to use.`
}

logger.log('Version currently installed:', version)
if (version === null || (options.version && !satisfies(version.version, options.version)) || unsupportedMySQLIsInstalled) {
let binaryInfo: BinaryInfo;
Expand All @@ -70,6 +64,12 @@ export async function createDB(opts?: ServerOptions) {
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!`
}

if (lt(binaryInfo.version, MIN_SUPPORTED_MYSQL)) {
//The difference between the throw here and the throw above is this throw is because the selected "version" is not supported.
//The throw above is because the system-installed MySQL is out of date and "ignoreUnsupportedSystemVersion" is not set to true.
throw `The selected version of MySQL (${options.version}) is not currently supported by this package. Please choose a different version to use.`
}

try {
binaryFilepath = await downloadBinary(binaryInfo, options, logger);
} catch (error) {
Expand Down

0 comments on commit 728e21c

Please sign in to comment.