mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 13:46:00 +00:00
Shell: Run script
This commit is contained in:
@@ -330,6 +330,29 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify(
|
||||
});
|
||||
};
|
||||
|
||||
const handleGenerateRunScript = () => {
|
||||
openNewTab(
|
||||
{
|
||||
title: 'Shell #',
|
||||
icon: 'img shell',
|
||||
tabComponent: 'ShellTab',
|
||||
},
|
||||
{
|
||||
editor: `// @require ${extractPackageName(connection.engine)}
|
||||
|
||||
await dbgateApi.executeQuery(${JSON.stringify(
|
||||
{
|
||||
connection: extractShellConnection(connection, name),
|
||||
sql: 'your script here',
|
||||
},
|
||||
undefined,
|
||||
2
|
||||
)});
|
||||
`,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const handleShowDataDeployer = () => {
|
||||
showModal(ChooseArchiveFolderModal, {
|
||||
message: 'Choose archive folder for data deployer',
|
||||
@@ -439,6 +462,11 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify(
|
||||
text: 'Shell: Drop all objects',
|
||||
},
|
||||
|
||||
{
|
||||
onClick: handleGenerateRunScript,
|
||||
text: 'Shell: Run script',
|
||||
},
|
||||
|
||||
driver?.databaseEngineTypes?.includes('sql') &&
|
||||
hasPermission(`dbops/import`) && {
|
||||
onClick: handleShowDataDeployer,
|
||||
|
||||
Reference in New Issue
Block a user