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