diff --git a/engine/dump.js b/engine/dump.js index c1c2301..db50f80 100644 --- a/engine/dump.js +++ b/engine/dump.js @@ -9,8 +9,6 @@ require("dotenv").config({ path: path.resolve(process.cwd(), ".env"), }); -const varDatabaseDbHandler = require("./engine/utils/varDatabaseDbHandler"); - const mysqlPath = process.platform?.match(/win/i) ? "'" + "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysql.exe" + "'" : "mysql"; const mysqlDumpPath = process.platform?.match(/win/i) ? "'" + "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe" + "'" : "mysqldump"; @@ -29,26 +27,22 @@ if (!dbName?.match(/./)) { process.exit(); } -varDatabaseDbHandler({ - queryString: `CREATE DATABASE \`${dbName}\` IF NOT EXISTS CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`, - database: dbName, -}).then((res) => { - console.log("Database creation attempt completed =>", res); - try { - let execSyncOptions = { - cwd: process.cwd(), - }; +try { + let execSyncOptions = { + cwd: process.cwd(), + }; - if (process.platform.match(/win/i)) execSyncOptions.shell = "bash.exe"; + if (process.platform.match(/win/i)) execSyncOptions.shell = "bash.exe"; - execSync(`${mysqlPath} -u ${process.env.DB_USERNAME} -p${process.env.DB_PASSWORD} ${dbName} < ${dumpFilePath}`, execSyncOptions); + const dump = execSync(`${mysqlPath} -u ${process.env.DB_USERNAME} -p${process.env.DB_PASSWORD} ${dbName} < ${dumpFilePath}`, execSyncOptions); - console.log("Dumped successfully"); + console.log("Dumped successfully", dump.toString()); - //////////////////////////////////////// - //////////////////////////////////////// - //////////////////////////////////////// - } catch (error) { - console.log("Dump Error: ", error.message); - } -}); + console.log("Dumped successfully"); + + //////////////////////////////////////// + //////////////////////////////////////// + //////////////////////////////////////// +} catch (error) { + console.log("Dump Error: ", error.message); +} diff --git a/package.json b/package.json index 73901d8..88203f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.5.6", + "version": "1.5.7", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": {