diff --git a/clause/on_conflict.go b/clause/on_conflict.go index 47fe169c..5ecd8e93 100644 --- a/clause/on_conflict.go +++ b/clause/on_conflict.go @@ -1,11 +1,12 @@ package clause type OnConflict struct { - Columns []Column - Where Where - DoNothing bool - DoUpdates Set - UpdateAll bool + Columns []Column + Where Where + OnConstraint string + DoNothing bool + DoUpdates Set + UpdateAll bool } func (OnConflict) Name() string { @@ -31,6 +32,12 @@ func (onConflict OnConflict) Build(builder Builder) { builder.WriteByte(' ') } + if onConflict.OnConstraint != "" { + builder.WriteString("ON CONSTRAINT ") + builder.WriteString(onConflict.OnConstraint) + builder.WriteByte(' ') + } + if onConflict.DoNothing { builder.WriteString("DO NOTHING") } else {