test new contraints/keys for obj_msg

This commit is contained in:
shoopea 2019-08-13 11:09:44 +08:00
parent 4c01afb0de
commit 62ef0516c6
2 changed files with 14 additions and 12 deletions

2
msg.go
View File

@ -137,6 +137,7 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
} else {
cwm.TreasurerID64 = 0
}
/*
log.Printf("parseSubTypeMessageGRolesAck : Guild roles Ack identified\n")
log.Printf("parseSubTypeMessageGRolesAck : Bartender : %s\n", r.ReplaceAllString(m.Text, "${Bartender}"))
log.Printf("parseSubTypeMessageGRolesAck : Commander : %s\n", r.ReplaceAllString(m.Text, "${Commander}"))
@ -146,6 +147,7 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
log.Printf("cwm.CommanderID64 : %d\n", cwm.CommanderID64)
log.Printf("cwm.SquireID64 : %d\n", cwm.SquireID64)
log.Printf("cwm.TreasurerID64 : %d\n", cwm.TreasurerID64)
*/
return &cwm, nil
}

6
sql.go
View File

@ -130,12 +130,12 @@ func initDB() {
obj_id BIGINT UNSIGNED NOT NULL
,msg_id BIGINT NOT NULL
,chat_id BIGINT NOT NULL
,user_id BIGINT NOT NULL
,sender_user_id BIGINT NOT NULL
,user_id BIGINT NOT NULL CHECK (user_id > 0)
,sender_user_id BIGINT NOT NULL CHECK (sender_user_id > 0)
,date DATETIME NOT NULL
,text VARCHAR(4096) NOT NULL
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
,UNIQUE KEY (msg_id, chat_id, sender_user_id)
,UNIQUE KEY (msg_id, chat_id, user_id, sender_user_id)
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_bin;`)
failOnError(err, "initDB : create table obj_msg")
log.Println("initDB : obj_msg created ...")