add created_at for version_config

This commit is contained in:
DeniskaRediska committed 2020-07-10 19:38:35 +03:00
1 parent 713db0aa4c
commit a3576cc3f4
3 files changed
+10 -2

No files matched your search

+6 -1
View File
@@ -1,10 +1,15 @@
package entity
import (
"time"
)
type VersionConfig struct {
//nolint
tableName string `pg:"?db_schema.version_config" json:"-"`
Id string
ConfigVersion int32
ConfigId string
ConfigVersion int32
Data ConfigData `json:"data" pg:",notnull"`
CreatedAt time.Time
}
@@ -5,7 +5,7 @@ CREATE TABLE version_config
config_id VARCHAR(255) NOT NULL,
config_version INT4 NOT NULL,
data JSONB NOT NULL DEFAULT '{}',
created_at TIMESTAMP NOT NULL DEFAULT NOW()
created_at TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc')
);
-- +goose Down
+3
View File
@@ -1,6 +1,8 @@
package service
import (
"time"
log "github.com/integration-system/isp-log"
"isp-config-service/cluster"
"isp-config-service/codes"
@@ -46,6 +48,7 @@ func (s configHistoryService) SaveConfigVersion(id string, oldConfig entity.Conf
ConfigVersion: oldConfig.Version,
ConfigId: oldConfig.Id,
Data: oldConfig.Data,
CreatedAt: time.Now().UTC(),
}
removedVersionId := state.WriteableVersionConfigStore().Update(cfg)
if holder.ClusterClient.IsLeader() {