From f8c3dff115d50ac3338b45195fc879e37cbc9e7b Mon Sep 17 00:00:00 2001 From: crazycs Date: Wed, 23 Jan 2019 14:35:14 +0800 Subject: [PATCH] model: add version number to Column (#183) --- model/model.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/model/model.go b/model/model.go index a5ebab0eb..2dbfaf1cf 100644 --- a/model/model.go +++ b/model/model.go @@ -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"` @@ -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.