create msg_rules_v

This commit is contained in:
shoopea 2019-08-27 12:07:07 +08:00
parent 52000472bb
commit e2c8e45bbe

12
sql.go
View File

@ -294,6 +294,18 @@ func initDB() {
failOnError(err, "initDB : create table msg_rules") failOnError(err, "initDB : create table msg_rules")
log.Println("initDB : msg_rules created ...") log.Println("initDB : msg_rules created ...")
_, err = db.Exec(`CREATE VIEW msg_rules_v AS
SELECT r.id
,r.prio
,r.descn COLLATE utf8mb4_unicode_ci AS descn
,r.rule COLLATE utf8mb4_unicode_ci AS rule
,cost.intl_id AS msg_type
FROM msg_rule r
,code_obj_sub_type cost
WHERE cost.id = r.msg_type_id;`)
failOnError(err, "initDB : create table msg_rules_v")
log.Println("initDB : msg_rules created ...")
_, err = db.Exec(`CREATE TABLE obj_item ( _, err = db.Exec(`CREATE TABLE obj_item (
obj_id BIGINT UNSIGNED NOT NULL obj_id BIGINT UNSIGNED NOT NULL
,intl_id VARCHAR(32) ,intl_id VARCHAR(32)