mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 02:43:59 +00:00
rename mongo collection #223
This commit is contained in:
@@ -316,6 +316,10 @@
|
|||||||
label: 'Drop collection',
|
label: 'Drop collection',
|
||||||
isDropCollection: true,
|
isDropCollection: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Rename collection',
|
||||||
|
isRenameCollection: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
divider: true,
|
divider: true,
|
||||||
},
|
},
|
||||||
@@ -565,6 +569,20 @@
|
|||||||
apiCall('database-connections/sync-model', dbid);
|
apiCall('database-connections/sync-model', dbid);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else if (menu.isRenameCollection) {
|
||||||
|
showModal(InputTextModal, {
|
||||||
|
label: 'New collection name',
|
||||||
|
header: 'Rename collection',
|
||||||
|
value: data.pureName,
|
||||||
|
onConfirm: async newName => {
|
||||||
|
const dbid = _.pick(data, ['conid', 'database']);
|
||||||
|
await apiCall('database-connections/run-script', {
|
||||||
|
...dbid,
|
||||||
|
sql: `db.renameCollection('${data.pureName}', '${newName}')`,
|
||||||
|
});
|
||||||
|
apiCall('database-connections/sync-model', dbid);
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
openDatabaseObjectDetail(
|
openDatabaseObjectDetail(
|
||||||
menu.tab,
|
menu.tab,
|
||||||
@@ -608,6 +626,7 @@
|
|||||||
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';
|
||||||
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let passProps;
|
export let passProps;
|
||||||
|
|||||||
Reference in New Issue
Block a user