mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 22:43:58 +00:00
hide indexes from clickhouse
This commit is contained in:
1
packages/types/dialect.d.ts
vendored
1
packages/types/dialect.d.ts
vendored
@@ -37,6 +37,7 @@ export interface SqlDialect {
|
|||||||
specificNullabilityImplementation?: boolean;
|
specificNullabilityImplementation?: boolean;
|
||||||
omitForeignKeys?: boolean;
|
omitForeignKeys?: boolean;
|
||||||
omitUniqueConstraints?: boolean;
|
omitUniqueConstraints?: boolean;
|
||||||
|
omitIndexes?: boolean;
|
||||||
sortingKeys?: boolean;
|
sortingKeys?: boolean;
|
||||||
|
|
||||||
// syntax for create column: ALTER TABLE table ADD COLUMN column
|
// syntax for create column: ALTER TABLE table ADD COLUMN column
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
icon: 'icon add-key',
|
icon: 'icon add-key',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
testEnabled: () => getCurrentEditor()?.getIsWritable(),
|
testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitForeignKeys,
|
||||||
onClick: () => getCurrentEditor().addForeignKey(),
|
onClick: () => getCurrentEditor().addForeignKey(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
icon: 'icon add-key',
|
icon: 'icon add-key',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
testEnabled: () => getCurrentEditor()?.getIsWritable(),
|
testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitIndexes,
|
||||||
onClick: () => getCurrentEditor().addIndex(),
|
onClick: () => getCurrentEditor().addIndex(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
icon: 'icon add-key',
|
icon: 'icon add-key',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
testEnabled: () => getCurrentEditor()?.getIsWritable(),
|
testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitUniqueConstraints,
|
||||||
onClick: () => getCurrentEditor().addUnique(),
|
onClick: () => getCurrentEditor().addUnique(),
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -98,6 +98,10 @@
|
|||||||
return isWritable;
|
return isWritable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDialect() {
|
||||||
|
return driver?.dialect;
|
||||||
|
}
|
||||||
|
|
||||||
export function addColumn() {
|
export function addColumn() {
|
||||||
showModal(ColumnEditorModal, {
|
showModal(ColumnEditorModal, {
|
||||||
setTableInfo,
|
setTableInfo,
|
||||||
@@ -275,45 +279,47 @@
|
|||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<ObjectListControl
|
{#if !driver?.dialect?.omitIndexes}
|
||||||
collection={indexes}
|
<ObjectListControl
|
||||||
onAddNew={isWritable && columns?.length > 0 ? addIndex : null}
|
collection={indexes}
|
||||||
title={`Indexes (${indexes?.length || 0})`}
|
onAddNew={isWritable && columns?.length > 0 ? addIndex : null}
|
||||||
emptyMessage={isWritable ? 'No index defined' : null}
|
title={`Indexes (${indexes?.length || 0})`}
|
||||||
clickable
|
emptyMessage={isWritable ? 'No index defined' : null}
|
||||||
on:clickrow={e => showModal(IndexEditorModal, { constraintInfo: e.detail, tableInfo, setTableInfo })}
|
clickable
|
||||||
columns={[
|
on:clickrow={e => showModal(IndexEditorModal, { constraintInfo: e.detail, tableInfo, setTableInfo })}
|
||||||
{
|
columns={[
|
||||||
fieldName: 'columns',
|
{
|
||||||
header: 'Columns',
|
fieldName: 'columns',
|
||||||
slot: 0,
|
header: 'Columns',
|
||||||
},
|
slot: 0,
|
||||||
{
|
},
|
||||||
fieldName: 'unique',
|
{
|
||||||
header: 'Unique',
|
fieldName: 'unique',
|
||||||
slot: 1,
|
header: 'Unique',
|
||||||
},
|
slot: 1,
|
||||||
isWritable
|
},
|
||||||
? {
|
isWritable
|
||||||
fieldName: 'actions',
|
? {
|
||||||
sortable: true,
|
fieldName: 'actions',
|
||||||
slot: 2,
|
sortable: true,
|
||||||
}
|
slot: 2,
|
||||||
: null,
|
}
|
||||||
]}
|
: null,
|
||||||
>
|
]}
|
||||||
<svelte:fragment slot="name" let:row><ConstraintLabel {...row} /></svelte:fragment>
|
|
||||||
<svelte:fragment slot="0" let:row>{row?.columns.map(x => x.columnName).join(', ')}</svelte:fragment>
|
|
||||||
<svelte:fragment slot="1" let:row>{row?.isUnique ? 'YES' : 'NO'}</svelte:fragment>
|
|
||||||
<svelte:fragment slot="2" let:row
|
|
||||||
><Link
|
|
||||||
onClick={e => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setTableInfo(tbl => editorDeleteConstraint(tbl, row));
|
|
||||||
}}>Remove</Link
|
|
||||||
></svelte:fragment
|
|
||||||
>
|
>
|
||||||
</ObjectListControl>
|
<svelte:fragment slot="name" let:row><ConstraintLabel {...row} /></svelte:fragment>
|
||||||
|
<svelte:fragment slot="0" let:row>{row?.columns.map(x => x.columnName).join(', ')}</svelte:fragment>
|
||||||
|
<svelte:fragment slot="1" let:row>{row?.isUnique ? 'YES' : 'NO'}</svelte:fragment>
|
||||||
|
<svelte:fragment slot="2" let:row
|
||||||
|
><Link
|
||||||
|
onClick={e => {
|
||||||
|
e.stopPropagation();
|
||||||
|
setTableInfo(tbl => editorDeleteConstraint(tbl, row));
|
||||||
|
}}>Remove</Link
|
||||||
|
></svelte:fragment
|
||||||
|
>
|
||||||
|
</ObjectListControl>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if !driver?.dialect?.omitUniqueConstraints}
|
{#if !driver?.dialect?.omitUniqueConstraints}
|
||||||
<ObjectListControl
|
<ObjectListControl
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
<ToolStripCommandButton command="tableStructure.save" />
|
<ToolStripCommandButton command="tableStructure.save" />
|
||||||
<ToolStripCommandButton command="tableStructure.reset" />
|
<ToolStripCommandButton command="tableStructure.reset" />
|
||||||
<ToolStripCommandButton command="tableEditor.addColumn" />
|
<ToolStripCommandButton command="tableEditor.addColumn" />
|
||||||
<ToolStripCommandButton command="tableEditor.addIndex" />
|
<ToolStripCommandButton command="tableEditor.addIndex" hideDisabled />
|
||||||
|
|
||||||
{#if objectTypeField == 'tables'}
|
{#if objectTypeField == 'tables'}
|
||||||
<ToolStripButton
|
<ToolStripButton
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ const dialect = {
|
|||||||
specificNullabilityImplementation: true,
|
specificNullabilityImplementation: true,
|
||||||
omitForeignKeys: true,
|
omitForeignKeys: true,
|
||||||
omitUniqueConstraints: true,
|
omitUniqueConstraints: true,
|
||||||
|
omitIndexes: true,
|
||||||
sortingKeys: true,
|
sortingKeys: true,
|
||||||
|
|
||||||
columnProperties: {
|
columnProperties: {
|
||||||
|
|||||||
Reference in New Issue
Block a user