diff --git a/server/pkg/dal/alteration.go b/server/pkg/dal/alteration.go index ade366b06..42a265361 100644 --- a/server/pkg/dal/alteration.go +++ b/server/pkg/dal/alteration.go @@ -96,10 +96,12 @@ func (aa AlterationSet) Merge(bb AlterationSet) (cc AlterationSet) { } if a.compare(*aux[j]) { + if !found { + cc = append(cc, aux[j]) + } + seen[j] = true found = true - cc = append(cc, aux[j]) - break } } diff --git a/server/pkg/dal/alteration_test.go b/server/pkg/dal/alteration_test.go index fde6aa32a..8d7c8e0dc 100644 --- a/server/pkg/dal/alteration_test.go +++ b/server/pkg/dal/alteration_test.go @@ -89,6 +89,14 @@ func TestMerge(t *testing.T) { }, }, }, + &Alteration{ + AttributeAdd: &AttributeAdd{ + Attr: &Attribute{ + Ident: "foo", + Type: &TypeJSON{Nullable: false}, + }, + }, + }, }, cc: AlterationSet{ &Alteration{