diff --git a/IHP/IDE/SchemaDesigner/Controller/Columns.hs b/IHP/IDE/SchemaDesigner/Controller/Columns.hs index 00b2b2b94..2761eae6f 100644 --- a/IHP/IDE/SchemaDesigner/Controller/Columns.hs +++ b/IHP/IDE/SchemaDesigner/Controller/Columns.hs @@ -12,7 +12,7 @@ import IHP.IDE.SchemaDesigner.View.Columns.EditForeignKey import IHP.IDE.SchemaDesigner.Parser import IHP.IDE.SchemaDesigner.Compiler import IHP.IDE.SchemaDesigner.Types -import IHP.IDE.SchemaDesigner.View.Layout (findStatementByName, findStatementByName, removeQuotes, replace, getDefaultValue, isIllegalKeyword) +import IHP.IDE.SchemaDesigner.View.Layout (findStatementByName, findStatementByName, removeQuotes, replace, getDefaultValue, isIllegalKeyword, findForeignKey) import qualified IHP.SchemaCompiler as SchemaCompiler import qualified System.Process as Process import IHP.IDE.SchemaDesigner.Parser (schemaFilePath) @@ -101,6 +101,9 @@ instance Controller ColumnsController where statements <- readSchema let tableName = param "tableName" let columnId = param "columnId" + let columnName = param "columnName" + case findForeignKey statements tableName columnName of + Just AddConstraint { constraintName, .. } -> updateSchema (deleteForeignKeyConstraint constraintName) updateSchema (map (deleteColumnInTable tableName columnId)) redirectTo ShowTableAction { .. } diff --git a/IHP/IDE/SchemaDesigner/View/Layout.hs b/IHP/IDE/SchemaDesigner/View/Layout.hs index efbae3201..7eda93591 100644 --- a/IHP/IDE/SchemaDesigner/View/Layout.hs +++ b/IHP/IDE/SchemaDesigner/View/Layout.hs @@ -1,4 +1,4 @@ -module IHP.IDE.SchemaDesigner.View.Layout (schemaDesignerLayout, findStatementByName, visualNav, renderColumnSelector, renderColumn, renderEnumSelector, renderValue, renderObjectSelector, removeQuotes, replace, getDefaultValue, databaseControls, isIllegalKeyword) where +module IHP.IDE.SchemaDesigner.View.Layout (schemaDesignerLayout, findStatementByName, visualNav, renderColumnSelector, renderColumn, renderEnumSelector, renderValue, renderObjectSelector, removeQuotes, replace, getDefaultValue, databaseControls, isIllegalKeyword, findForeignKey) where import IHP.ViewPrelude import IHP.IDE.SchemaDesigner.Types @@ -123,7 +123,7 @@ renderColumn Column { name, primaryKey, columnType, defaultValue, notNull, isUni