Upgrades
This commit is contained in:
parent
5f1f7da024
commit
2fc92daa94
@ -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 {
|
||||
try {
|
||||
let execSyncOptions = {
|
||||
cwd: process.cwd(),
|
||||
};
|
||||
|
||||
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", dump.toString());
|
||||
|
||||
console.log("Dumped successfully");
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} catch (error) {
|
||||
} catch (error) {
|
||||
console.log("Dump Error: ", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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": {
|
||||
|
Loading…
Reference in New Issue
Block a user