Updates
This commit is contained in:
Vendored
+5
-4
@@ -7,6 +7,7 @@ var _a, _b, _c;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const child_process_1 = require("child_process");
|
||||
const grab_db_names_1 = __importDefault(require("../package-shared/utils/grab-db-names"));
|
||||
require("dotenv").config({
|
||||
path: path_1.default.resolve(process.cwd(), ".env"),
|
||||
});
|
||||
@@ -18,15 +19,15 @@ const mysqlDumpPath = ((_b = process.platform) === null || _b === void 0 ? void
|
||||
"C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe" +
|
||||
"'"
|
||||
: "mysqldump";
|
||||
const { DSQL_USER, DSQL_PASS, DSQL_DB_NAME } = process.env;
|
||||
const dbName = DSQL_DB_NAME || "";
|
||||
const { DSQL_USER, DSQL_PASS } = process.env;
|
||||
const { dbFullName } = (0, grab_db_names_1.default)();
|
||||
const dumpFilePathArg = process.argv.indexOf("--file");
|
||||
if (dumpFilePathArg < 0) {
|
||||
console.log("Please provide a dump file path using `--file` argument");
|
||||
process.exit();
|
||||
}
|
||||
const dumpFilePath = process.argv[dumpFilePathArg + 1];
|
||||
if (!(dbName === null || dbName === void 0 ? void 0 : dbName.match(/./))) {
|
||||
if (!(dbFullName === null || dbFullName === void 0 ? void 0 : dbFullName.match(/./))) {
|
||||
console.log("DSQL_DB_NAME is required in your `.env` file");
|
||||
process.exit();
|
||||
}
|
||||
@@ -39,7 +40,7 @@ try {
|
||||
cwd: process.cwd(),
|
||||
};
|
||||
// if (process.platform.match(/win/i)) execSyncOptions.shell = "bash.exe";
|
||||
const dump = (0, child_process_1.execSync)(`${mysqlPath} -u ${DSQL_USER} -p${DSQL_PASS} ${dbName} < ${dumpFilePath}`, execSyncOptions);
|
||||
const dump = (0, child_process_1.execSync)(`${mysqlPath} -u ${DSQL_USER} -p${DSQL_PASS} ${dbFullName} < ${dumpFilePath}`, execSyncOptions);
|
||||
console.log("Dumped successfully", dump.toString());
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user