未验证 提交 05300ec0 编写于 作者: X xtan 提交者: GitHub

fix: compatible with pg (#1683)

* fix: fix pg migrate

* fix: compatible with pg

* fix: compatible with pg
上级 67fb49e5
......@@ -374,7 +374,7 @@ CREATE TABLE alert_subscribe (
cluster varchar(128) not null,
rule_id bigint not null default 0,
severities varchar(32) not null default '',
tags varchar(4096) not null default '' ,
tags varchar(4096) not null default '[]',
redefine_severity smallint default 0 ,
new_severity smallint not null ,
redefine_channels smallint default 0 ,
......
......@@ -82,6 +82,7 @@ RSAPassWord = ""
[DB]
# postgres: host=%s port=%s user=%s dbname=%s password=%s sslmode=%s
# postgres: DSN="host=127.0.0.1 port=5432 user=root dbname=n9e_v6 password=1234 sslmode=disable"
DSN="root:1234@tcp(127.0.0.1:3306)/n9e_v6?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
# enable debug mode or not
Debug = false
......
......@@ -59,7 +59,13 @@ func (j *JSONObj) UnmarshalJSON(data []byte) error {
func (j *JSONArr) Scan(value interface{}) error {
bytes, ok := value.([]byte)
if !ok {
return errors.New(fmt.Sprint("Failed to unmarshal JSONB value:", value))
// 判断是不是string类型 Postgres的varchar scan出来是string类型
strings, ok := value.(string)
if !ok {
return errors.New(fmt.Sprint("Failed to unmarshal JSONB value:", value))
}
// string类型转byte[]
bytes = []byte(strings)
}
result := json.RawMessage{}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册