diff --git a/scripts/sql/apolloconfigdb.sql b/scripts/sql/apolloconfigdb.sql index c90d9b8be19..40f6c81a54f 100644 --- a/scripts/sql/apolloconfigdb.sql +++ b/scripts/sql/apolloconfigdb.sql @@ -422,8 +422,8 @@ CREATE TABLE `ServiceRegistry` ( `Uri` VARCHAR(64) NOT NULL COMMENT '服务地址', `Cluster` VARCHAR(64) NOT NULL COMMENT '集群,可以用来标识apollo.cluster或者网络分区', `Metadata` VARCHAR(1024) NOT NULL DEFAULT '{}' COMMENT '元数据,key value结构的json object,为了方面后面扩展功能而不需要修改表结构', - `DataChange_CreatedTime` TIMESTAMP NOT NULL COMMENT '创建时间', - `DataChange_LastTime` TIMESTAMP NOT NULL COMMENT '最后修改时间', + `DataChange_CreatedTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `DataChange_LastTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE INDEX `IX_UNIQUE_KEY` (`ServiceName`, `Uri`), INDEX `IX_DataChange_LastTime` (`DataChange_LastTime`) diff --git a/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql b/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql index 6cdd6ff384e..8ce329fb7a6 100644 --- a/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql +++ b/scripts/sql/delta/v200-v210/apolloconfigdb-v200-v210.sql @@ -29,8 +29,8 @@ CREATE TABLE `ServiceRegistry` ( `Uri` VARCHAR(64) NOT NULL COMMENT '服务地址', `Cluster` VARCHAR(64) NOT NULL COMMENT '集群,可以用来标识apollo.cluster或者网络分区', `Metadata` VARCHAR(1024) NOT NULL DEFAULT '{}' COMMENT '元数据,key value结构的json object,为了方面后面扩展功能而不需要修改表结构', - `DataChange_CreatedTime` TIMESTAMP NOT NULL COMMENT '创建时间', - `DataChange_LastTime` TIMESTAMP NOT NULL COMMENT '最后修改时间', + `DataChange_CreatedTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `DataChange_LastTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE INDEX `IX_UNIQUE_KEY` (`ServiceName`, `Uri`), INDEX `IX_DataChange_LastTime` (`DataChange_LastTime`)