mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 20:53:57 +00:00
fix + disabled new table for mongo
This commit is contained in:
@@ -80,15 +80,15 @@ export function fillConstraintNames(table: TableInfo, dialect: SqlDialect) {
|
|||||||
if (res.primaryKey && !res.primaryKey.constraintName && !dialect.anonymousPrimaryKey) {
|
if (res.primaryKey && !res.primaryKey.constraintName && !dialect.anonymousPrimaryKey) {
|
||||||
res.primaryKey.constraintName = `PK_${res.pureName}`;
|
res.primaryKey.constraintName = `PK_${res.pureName}`;
|
||||||
}
|
}
|
||||||
for (const fk of res.foreignKeys) {
|
for (const fk of res.foreignKeys || []) {
|
||||||
if (fk.constraintName) continue;
|
if (fk.constraintName) continue;
|
||||||
fk.constraintName = columnsConstraintName('FK', res, fk.columns);
|
fk.constraintName = columnsConstraintName('FK', res, fk.columns);
|
||||||
}
|
}
|
||||||
for (const ix of res.indexes) {
|
for (const ix of res.indexes || []) {
|
||||||
if (ix.constraintName) continue;
|
if (ix.constraintName) continue;
|
||||||
ix.constraintName = columnsConstraintName('IX', res, ix.columns);
|
ix.constraintName = columnsConstraintName('IX', res, ix.columns);
|
||||||
}
|
}
|
||||||
for (const uq of res.uniques) {
|
for (const uq of res.uniques || []) {
|
||||||
if (uq.constraintName) continue;
|
if (uq.constraintName) continue;
|
||||||
uq.constraintName = columnsConstraintName('UQ', res, uq.columns);
|
uq.constraintName = columnsConstraintName('UQ', res, uq.columns);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { currentDatabase, currentTheme, extensions, getVisibleToolbar, visibleToolbar } from '../stores';
|
import { currentDatabase, currentTheme, extensions, getExtensions, getVisibleToolbar, visibleToolbar } from '../stores';
|
||||||
import registerCommand from './registerCommand';
|
import registerCommand from './registerCommand';
|
||||||
import { derived, get } from 'svelte/store';
|
import { derived, get } from 'svelte/store';
|
||||||
import { ThemeDefinition } from 'dbgate-types';
|
import { ThemeDefinition } from 'dbgate-types';
|
||||||
@@ -18,6 +18,7 @@ import { getCurrentConfig, getCurrentDatabase } from '../stores';
|
|||||||
import './recentDatabaseSwitch';
|
import './recentDatabaseSwitch';
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import { findEngineDriver } from 'dbgate-tools';
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
|
|
||||||
@@ -112,7 +113,10 @@ registerCommand({
|
|||||||
name: 'Table',
|
name: 'Table',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
toolbarName: 'New table',
|
toolbarName: 'New table',
|
||||||
testEnabled: () => !!get(currentDatabase),
|
testEnabled: () => {
|
||||||
|
const driver = findEngineDriver(get(currentDatabase)?.connection, getExtensions());
|
||||||
|
return !!get(currentDatabase) && !driver?.dialect?.nosql;
|
||||||
|
},
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
const $currentDatabase = get(currentDatabase);
|
const $currentDatabase = get(currentDatabase);
|
||||||
const connection = _.get($currentDatabase, 'connection') || {};
|
const connection = _.get($currentDatabase, 'connection') || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user