mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 14:46:01 +00:00
generic drop collection
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
import {copyTextToClipboard} from "../utility/clipboard";
|
import { copyTextToClipboard } from '../utility/clipboard';
|
||||||
|
|
||||||
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||||
export const createMatcher =
|
export const createMatcher =
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
{
|
{
|
||||||
label: 'Copy table name',
|
label: 'Copy table name',
|
||||||
isCopyTableName: true,
|
isCopyTableName: true,
|
||||||
requiresWriteAccess: false
|
requiresWriteAccess: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Create table backup',
|
label: 'Create table backup',
|
||||||
@@ -515,7 +515,10 @@
|
|||||||
message: `Really drop collection ${data.pureName}?`,
|
message: `Really drop collection ${data.pureName}?`,
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
const dbid = _.pick(data, ['conid', 'database']);
|
const dbid = _.pick(data, ['conid', 'database']);
|
||||||
saveScriptToDatabase(dbid, `db.dropCollection('${data.pureName}')`);
|
runOperationOnDatabase(dbid, {
|
||||||
|
type: 'dropCollection',
|
||||||
|
collection: data.pureName,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (menu.isCopyTableName) {
|
} else if (menu.isCopyTableName) {
|
||||||
@@ -786,7 +789,7 @@
|
|||||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||||
import ConfirmSqlModal, { saveScriptToDatabase } from '../modals/ConfirmSqlModal.svelte';
|
import ConfirmSqlModal, { runOperationOnDatabase, saveScriptToDatabase } from '../modals/ConfirmSqlModal.svelte';
|
||||||
import { alterDatabaseDialog, renameDatabaseObjectDialog } from '../utility/alterDatabaseTools';
|
import { alterDatabaseDialog, renameDatabaseObjectDialog } from '../utility/alterDatabaseTools';
|
||||||
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ const driver = {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case 'createCollection':
|
case 'createCollection':
|
||||||
await this.script(pool, `db.createCollection('${operation.collection}')`);
|
await this.script(pool, `db.createCollection('${operation.collection}')`);
|
||||||
|
case 'dropOperation':
|
||||||
|
await this.script(pool, `db.dropCollection('${operation.collection}')`);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Operation type ${type} not supported`);
|
throw new Error(`Operation type ${type} not supported`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user