Upgrades
This commit is contained in:
parent
a2cdf39280
commit
cc65ea23b8
@ -12,7 +12,9 @@ require("dotenv").config({
|
||||
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";
|
||||
|
||||
const dbName = process.env.DSQL_DB_NAME || "";
|
||||
const { DSQL_HOST, DSQL_USER, DSQL_PASS, DSQL_DB_NAME, DSQL_KEY, DSQL_REF_DB_NAME, DSQL_FULL_SYNC, DSQL_ENCRYPTION_KEY, DSQL_ENCRYPTION_SALT } = process.env;
|
||||
|
||||
const dbName = DSQL_DB_NAME || "";
|
||||
const dumpFilePathArg = process.argv.indexOf("--file");
|
||||
|
||||
if (dumpFilePathArg < 0) {
|
||||
@ -27,6 +29,11 @@ if (!dbName?.match(/./)) {
|
||||
process.exit();
|
||||
}
|
||||
|
||||
if (!DSQL_USER?.match(/./) || !DSQL_PASS?.match(/./)) {
|
||||
console.log("DSQL_USER and DSQL_PASS are required in your `.env` file");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
try {
|
||||
let execSyncOptions = {
|
||||
cwd: process.cwd(),
|
||||
@ -34,7 +41,7 @@ try {
|
||||
|
||||
if (process.platform.match(/win/i)) execSyncOptions.shell = "bash.exe";
|
||||
|
||||
const dump = execSync(`${mysqlPath} -u ${process.env.DB_USERNAME} -p${process.env.DB_PASSWORD} ${dbName} < ${dumpFilePath}`, execSyncOptions);
|
||||
const dump = execSync(`${mysqlPath} -u ${DSQL_USER} -p${DSQL_PASS} ${dbName} < ${dumpFilePath}`, execSyncOptions);
|
||||
|
||||
console.log("Dumped successfully", dump.toString());
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "datasquirel",
|
||||
"version": "1.5.8",
|
||||
"version": "1.5.9",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user