hide indexes from clickhouse

This commit is contained in:
Jan Prochazka
2024-09-12 13:20:15 +02:00
parent 2f1cbbd75e
commit d2e49967e4
4 changed files with 50 additions and 42 deletions

View File

@@ -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

View File

@@ -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,6 +279,7 @@
/> />
{/if} {/if}
{#if !driver?.dialect?.omitIndexes}
<ObjectListControl <ObjectListControl
collection={indexes} collection={indexes}
onAddNew={isWritable && columns?.length > 0 ? addIndex : null} onAddNew={isWritable && columns?.length > 0 ? addIndex : null}
@@ -314,6 +319,7 @@
></svelte:fragment ></svelte:fragment
> >
</ObjectListControl> </ObjectListControl>
{/if}
{#if !driver?.dialect?.omitUniqueConstraints} {#if !driver?.dialect?.omitUniqueConstraints}
<ObjectListControl <ObjectListControl

View File

@@ -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

View File

@@ -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: {