diff --git a/packages/web/src/tableeditor/ForeignKeyEditorModal.svelte b/packages/web/src/tableeditor/ForeignKeyEditorModal.svelte index 305bb5631..ce3428d8a 100644 --- a/packages/web/src/tableeditor/ForeignKeyEditorModal.svelte +++ b/packages/web/src/tableeditor/ForeignKeyEditorModal.svelte @@ -23,16 +23,25 @@ } from 'dbgate-tools'; import TextField from '../forms/TextField.svelte'; import SelectField from '../forms/SelectField.svelte'; + import _ from 'lodash'; export let constraintInfo; export let setTableInfo; export let tableInfo; export let dbInfo; + const foreignKeyActions = ['noAction', 'cascade', 'restrict', 'setNull']; + const foreignKeyActionsOptions = foreignKeyActions.map(x => ({ + label: _.startCase(x), + value: x, + })); + let constraintName = constraintInfo?.constraintName; let columns = constraintInfo?.columns || []; let refTableName = constraintInfo?.refTableName; let refSchemaName = constraintInfo?.refSchemaName; + let deleteAction = constraintInfo?.deleteAction ? _.camelCase(constraintInfo?.deleteAction) : null; + let updateAction = constraintInfo?.updateAction ? _.camelCase(constraintInfo?.updateAction) : null; $: refTableInfo = dbInfo?.tables?.find(x => x.pureName == refTableName && x.schemaName == refSchemaName); @@ -47,6 +56,8 @@ constraintType: 'foreignKey', refTableName, refSchemaName, + deleteAction: _.startCase(deleteAction).toUpperCase(), + updateAction: _.startCase(updateAction).toUpperCase(), }; } @@ -84,6 +95,36 @@ +
+
On update action
+
+ { + updateAction = e.detail || null; + }} + /> +
+
+ +
+
On delete action
+
+ { + deleteAction = e.detail || null; + }} + /> +
+
+
Base column - {tableInfo.pureName}