Skip to content

Commit

Permalink
model: add version number to Column (pingcap#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 authored Jan 23, 2019
1 parent 8358cd3 commit 614ccd7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ func (s SchemaState) String() string {
}
}

const (
// ColumnInfoVersion0 means the column info version is 0.
ColumnInfoVersion0 = uint64(0)
// ColumnInfoVersion1 means the column info version is 1.
ColumnInfoVersion1 = uint64(1)
)

// ColumnInfo provides meta data describing of a table column.
type ColumnInfo struct {
ID int64 `json:"id"`
Expand All @@ -76,6 +83,12 @@ type ColumnInfo struct {
types.FieldType `json:"type"`
State SchemaState `json:"state"`
Comment string `json:"comment"`
// Version means the version of the column info.
// Version = 0: For OriginDefaultValue and DefaultValue of timestamp column will stores the default time in system time zone.
// That is a bug if multiple TiDB servers in different system time zone.
// Version = 1: For OriginDefaultValue and DefaultValue of timestamp column will stores the default time in UTC time zone.
// This will fix bug in version 0. For compatibility with version 0, we add version field in column info struct.
Version uint64 `json:"version"`
}

// Clone clones ColumnInfo.
Expand Down

0 comments on commit 614ccd7

Please sign in to comment.