Skip to content

Commit

Permalink
Only serialize schema comment if it's not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
fulghum committed Jan 31, 2024
1 parent 936fc16 commit 7894356
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions go/libraries/doltcore/schema/encoding/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func serializeSchemaAsFlatbuffer(sch schema.Schema) ([]byte, error) {
rows := serializeClusteredIndex(b, sch)
indexes := serializeSecondaryIndexes(b, sch, sch.Indexes().AllIndexes())
checks := serializeChecks(b, sch.Checks().AllChecks())
comment := b.CreateString(sch.GetComment())

var hasFeaturesAfterTryAccessors bool
for _, col := range sch.GetAllCols().GetColumns() {
Expand All @@ -65,17 +64,18 @@ func serializeSchemaAsFlatbuffer(sch schema.Schema) ([]byte, error) {
break
}
}
if sch.GetComment() != "" {
hasFeaturesAfterTryAccessors = true
}

serial.TableSchemaStart(b)
serial.TableSchemaAddClusteredIndex(b, rows)
serial.TableSchemaAddColumns(b, columns)
serial.TableSchemaAddSecondaryIndexes(b, indexes)
serial.TableSchemaAddChecks(b, checks)
serial.TableSchemaAddCollation(b, serial.Collation(sch.GetCollation()))
serial.TableSchemaAddComment(b, comment)
if sch.GetComment() != "" {
comment := b.CreateString(sch.GetComment())
serial.TableSchemaAddComment(b, comment)
hasFeaturesAfterTryAccessors = true
}
if hasFeaturesAfterTryAccessors {
serial.TableSchemaAddHasFeaturesAfterTryAccessors(b, hasFeaturesAfterTryAccessors)
}
Expand Down

0 comments on commit 7894356

Please sign in to comment.