diff --git a/go/libraries/doltcore/schema/alterschema/droppk.go b/go/libraries/doltcore/schema/alterschema/droppk.go index 5ba94274f4..6fbde4b3c2 100644 --- a/go/libraries/doltcore/schema/alterschema/droppk.go +++ b/go/libraries/doltcore/schema/alterschema/droppk.go @@ -40,9 +40,9 @@ func DropPrimaryKeyFromTable(ctx context.Context, table *doltdb.Table, nbf *type newCollection := schema.MapColCollection(sch.GetAllCols(), func(col schema.Column) schema.Column { col.IsPartOfPK = false // Removing PK does not remove NOT NULL constraint, so add it back if it's somehow gone - if col.IsNullable() { - col.Constraints = append(col.Constraints, schema.NotNullConstraint{}) - } + //if col.IsNullable() { + // col.Constraints = append(col.Constraints, schema.NotNullConstraint{}) + //} return col }) diff --git a/go/libraries/doltcore/schema/constraint.go b/go/libraries/doltcore/schema/constraint.go index 5dfc7a8d1e..95b227315a 100644 --- a/go/libraries/doltcore/schema/constraint.go +++ b/go/libraries/doltcore/schema/constraint.go @@ -93,6 +93,12 @@ func IndexOfConstraint(constraints []ColConstraint, constraintType string) int { // ColConstraintsAreEqual validates two ColConstraint slices are identical. func ColConstraintsAreEqual(a, b []ColConstraint) bool { // kinda shitty. Probably shouldn't require order to be identical + if len(a) != len(b) { + return false + } else if len(a) == 0 { + return true + } + for i := 0; i < len(a); i++ { ca, cb := a[i], b[i] diff --git a/go/libraries/doltcore/schema/encoding/schema_marshaling.go b/go/libraries/doltcore/schema/encoding/schema_marshaling.go index 59730c00ea..b48269613f 100644 --- a/go/libraries/doltcore/schema/encoding/schema_marshaling.go +++ b/go/libraries/doltcore/schema/encoding/schema_marshaling.go @@ -63,7 +63,7 @@ func encodeAllColConstraints(constraints []schema.ColConstraint) []encodedConstr for _, c := range constraints { if c.GetConstraintType() == schema.NotNullConstraintType { if seenNotNull { - continue + //continue } seenNotNull = true }