diff --git a/packages/types/dialect.d.ts b/packages/types/dialect.d.ts
index 2bccd76ab..1c8c30bf2 100644
--- a/packages/types/dialect.d.ts
+++ b/packages/types/dialect.d.ts
@@ -37,6 +37,7 @@ export interface SqlDialect {
specificNullabilityImplementation?: boolean;
omitForeignKeys?: boolean;
omitUniqueConstraints?: boolean;
+ omitIndexes?: boolean;
sortingKeys?: boolean;
// syntax for create column: ALTER TABLE table ADD COLUMN column
diff --git a/packages/web/src/tableeditor/TableEditor.svelte b/packages/web/src/tableeditor/TableEditor.svelte
index 91f5e9a8c..2e65924f5 100644
--- a/packages/web/src/tableeditor/TableEditor.svelte
+++ b/packages/web/src/tableeditor/TableEditor.svelte
@@ -30,7 +30,7 @@
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
- testEnabled: () => getCurrentEditor()?.getIsWritable(),
+ testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitForeignKeys,
onClick: () => getCurrentEditor().addForeignKey(),
});
@@ -41,7 +41,7 @@
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
- testEnabled: () => getCurrentEditor()?.getIsWritable(),
+ testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitIndexes,
onClick: () => getCurrentEditor().addIndex(),
});
@@ -52,7 +52,7 @@
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
- testEnabled: () => getCurrentEditor()?.getIsWritable(),
+ testEnabled: () => getCurrentEditor()?.getIsWritable() && !getCurrentEditor()?.getDialect()?.omitUniqueConstraints,
onClick: () => getCurrentEditor().addUnique(),
});
@@ -98,6 +98,10 @@
return isWritable;
}
+ export function getDialect() {
+ return driver?.dialect;
+ }
+
export function addColumn() {
showModal(ColumnEditorModal, {
setTableInfo,
@@ -275,45 +279,47 @@
/>
{/if}
- 0 ? addIndex : null}
- title={`Indexes (${indexes?.length || 0})`}
- emptyMessage={isWritable ? 'No index defined' : null}
- clickable
- on:clickrow={e => showModal(IndexEditorModal, { constraintInfo: e.detail, tableInfo, setTableInfo })}
- columns={[
- {
- fieldName: 'columns',
- header: 'Columns',
- slot: 0,
- },
- {
- fieldName: 'unique',
- header: 'Unique',
- slot: 1,
- },
- isWritable
- ? {
- fieldName: 'actions',
- sortable: true,
- slot: 2,
- }
- : null,
- ]}
- >
-
- {row?.columns.map(x => x.columnName).join(', ')}
- {row?.isUnique ? 'YES' : 'NO'}
- {
- e.stopPropagation();
- setTableInfo(tbl => editorDeleteConstraint(tbl, row));
- }}>Remove 0 ? addIndex : null}
+ title={`Indexes (${indexes?.length || 0})`}
+ emptyMessage={isWritable ? 'No index defined' : null}
+ clickable
+ on:clickrow={e => showModal(IndexEditorModal, { constraintInfo: e.detail, tableInfo, setTableInfo })}
+ columns={[
+ {
+ fieldName: 'columns',
+ header: 'Columns',
+ slot: 0,
+ },
+ {
+ fieldName: 'unique',
+ header: 'Unique',
+ slot: 1,
+ },
+ isWritable
+ ? {
+ fieldName: 'actions',
+ sortable: true,
+ slot: 2,
+ }
+ : null,
+ ]}
>
-
+
+ {row?.columns.map(x => x.columnName).join(', ')}
+ {row?.isUnique ? 'YES' : 'NO'}
+ {
+ e.stopPropagation();
+ setTableInfo(tbl => editorDeleteConstraint(tbl, row));
+ }}>Remove
+
+ {/if}
{#if !driver?.dialect?.omitUniqueConstraints}
-
+
{#if objectTypeField == 'tables'}