mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
export sql dump - can export to files
This commit is contained in:
@@ -26,6 +26,28 @@ export async function importSqlDump(inputFile, connection) {
|
||||
// });
|
||||
}
|
||||
|
||||
export async function exportSqlDump(outputFile, connection, databaseName, pureFileName) {
|
||||
const script = getCurrentConfig().allowShellScripting ? new ScriptWriter() : new ScriptWriterJson();
|
||||
|
||||
script.dumpDatabase({
|
||||
connection,
|
||||
databaseName,
|
||||
outputFile,
|
||||
});
|
||||
|
||||
showModal(RunScriptModal, {
|
||||
script: script.getScript(),
|
||||
header: 'Exporting database',
|
||||
onOpenResult:
|
||||
pureFileName && !getElectron()
|
||||
? () => {
|
||||
window.open(`${resolveApi()}/uploads/get?file=${pureFileName}`, '_blank');
|
||||
}
|
||||
: null,
|
||||
openResultLabel: 'Download SQL file',
|
||||
});
|
||||
}
|
||||
|
||||
async function runImportExportScript({ script, runningMessage, canceledMessage, finishedMessage, afterFinish = null }) {
|
||||
const electron = getElectron();
|
||||
|
||||
@@ -126,25 +148,25 @@ export async function exportQuickExportFile(dataName, reader, format, columnMap
|
||||
);
|
||||
}
|
||||
|
||||
export async function exportSqlDump(connection, databaseName) {
|
||||
await saveExportedFile(
|
||||
[{ name: 'SQL files', extensions: ['sql'] }],
|
||||
`${databaseName}.sql`,
|
||||
'sql',
|
||||
`${databaseName}-dump`,
|
||||
filePath => {
|
||||
const script = getCurrentConfig().allowShellScripting ? new ScriptWriter() : new ScriptWriterJson();
|
||||
// export async function exportSqlDump(connection, databaseName) {
|
||||
// await saveExportedFile(
|
||||
// [{ name: 'SQL files', extensions: ['sql'] }],
|
||||
// `${databaseName}.sql`,
|
||||
// 'sql',
|
||||
// `${databaseName}-dump`,
|
||||
// filePath => {
|
||||
// const script = getCurrentConfig().allowShellScripting ? new ScriptWriter() : new ScriptWriterJson();
|
||||
|
||||
script.dumpDatabase({
|
||||
connection,
|
||||
databaseName,
|
||||
outputFile: filePath,
|
||||
});
|
||||
// script.dumpDatabase({
|
||||
// connection,
|
||||
// databaseName,
|
||||
// outputFile: filePath,
|
||||
// });
|
||||
|
||||
return script.getScript();
|
||||
}
|
||||
);
|
||||
}
|
||||
// return script.getScript();
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
export async function saveFileToDisk(
|
||||
filePathFunc,
|
||||
|
||||
Reference in New Issue
Block a user