This commit is contained in:
shoopea 2019-08-29 19:14:03 +08:00
parent 3f278b02a0
commit a857714b7a

11
sql.go
View File

@ -142,13 +142,19 @@ func initDB() {
_, err = db.Exec(`CREATE VIEW obj_msg_v AS
SELECT om.obj_id
,o.obj_sub_type_id AS msg_type_id
,cost.intl_id COLLATE utf8mb4_unicode_ci AS msg_type
,om.msg_id
,om.chat_id
,om.user_id
,om.sender_user_id
,om.date
,om.text COLLATE utf8mb4_unicode_ci AS text
FROM obj_msg om;`)
FROM obj_msg om
,obj o
,code_obj_sub_type cost
WHERE om.obj_id = o.id
AND cost.id = o.obj_sub_type_id;`)
failOnError(err, "initDB : create view obj_msg_v")
log.Println("initDB : obj_msg_v created ...")
@ -386,7 +392,8 @@ func initDB() {
_, err = db.Exec(`CREATE VIEW obj_job_v AS
SELECT oj.obj_id
,cost.intl_id COLLATE utf8mb4_unicode_ci AS job_type_intl_id
,o.obj_sub_type_id AS job_type_id
,cost.intl_id COLLATE utf8mb4_unicode_ci AS job_type
,oj.payload COLLATE utf8mb4_unicode_ci AS payload
FROM obj_job oj
,obj o