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

20
msg.go
View File

@ -137,15 +137,17 @@ 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}"))
log.Printf("parseSubTypeMessageGRolesAck : Squire : %s\n", r.ReplaceAllString(m.Text, "${Squire}"))
log.Printf("parseSubTypeMessageGRolesAck : Treasurer : %s\n", r.ReplaceAllString(m.Text, "${Treasurer}"))
log.Printf("cwm.BartenderID64 : %d\n", cwm.BartenderID64)
log.Printf("cwm.CommanderID64 : %d\n", cwm.CommanderID64)
log.Printf("cwm.SquireID64 : %d\n", cwm.SquireID64)
log.Printf("cwm.TreasurerID64 : %d\n", cwm.TreasurerID64)
/*
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}"))
log.Printf("parseSubTypeMessageGRolesAck : Squire : %s\n", r.ReplaceAllString(m.Text, "${Squire}"))
log.Printf("parseSubTypeMessageGRolesAck : Treasurer : %s\n", r.ReplaceAllString(m.Text, "${Treasurer}"))
log.Printf("cwm.BartenderID64 : %d\n", cwm.BartenderID64)
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 ...")