test
This commit is contained in:
parent
898846727a
commit
444f511acc
28
sql.go
28
sql.go
@ -582,30 +582,10 @@ func initDB() {
|
|||||||
log.Println("initDB : code_obj_sub_type populated ...")
|
log.Println("initDB : code_obj_sub_type populated ...")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE VIEW obj_msg_vault_v AS
|
_, err = db.Exec(`CREATE VIEW obj_msg_vault_v AS
|
||||||
SELECT x.sender_user_id user_id
|
SELECT om.sender_user_id user_id
|
||||||
,x.item_id
|
|
||||||
,(SELECT COALESCE(SUM(omix.quantity), 0)
|
|
||||||
FROM obj ox
|
|
||||||
,obj_msg omx
|
|
||||||
,obj_msg_item omix
|
|
||||||
WHERE ox.obj_sub_type_id = ` + strconv.Itoa(objSubTypeMessageGDepositAck) + `
|
|
||||||
AND omx.sender_user_id = x.sender_user_id
|
|
||||||
AND omx.obj_id = ox.id
|
|
||||||
AND omix.obj_id = ox.id
|
|
||||||
AND omix.item_id = x.item_id) deposit
|
|
||||||
,(SELECT coalesce(sum(omix.quantity), 0)
|
|
||||||
FROM obj ox
|
|
||||||
,obj_msg omx
|
|
||||||
,obj_msg_item omix
|
|
||||||
WHERE ox.obj_sub_type_id = ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `
|
|
||||||
AND omx.sender_user_id = x.sender_user_id
|
|
||||||
AND omx.obj_id = ox.id
|
|
||||||
AND omix.obj_id = ox.id
|
|
||||||
AND omix.item_id = x.item_id) withdraw
|
|
||||||
FROM (SELECT DISTINCT
|
|
||||||
om.sender_user_id
|
|
||||||
,om.chat_id
|
,om.chat_id
|
||||||
,omi.item_id
|
,omi.item_id
|
||||||
|
,omi.quantity
|
||||||
FROM obj o
|
FROM obj o
|
||||||
,obj_msg om
|
,obj_msg om
|
||||||
,obj_msg_item omi
|
,obj_msg_item omi
|
||||||
@ -613,8 +593,8 @@ func initDB() {
|
|||||||
AND o.obj_type_id = ` + strconv.Itoa(objTypeMessage) + `
|
AND o.obj_type_id = ` + strconv.Itoa(objTypeMessage) + `
|
||||||
AND o.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, ` + strconv.Itoa(objSubTypeMessageGDepositAck) + `)
|
AND o.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, ` + strconv.Itoa(objSubTypeMessageGDepositAck) + `)
|
||||||
AND omi.obj_id = o.id) x
|
AND omi.obj_id = o.id) x
|
||||||
ORDER BY x.sender_user_id ASC
|
ORDER BY om.sender_user_id ASC
|
||||||
,x.item_id ASC;`)
|
,omi.item_id ASC;`)
|
||||||
failOnError(err, "initDB : create view obj_msg_vault_v")
|
failOnError(err, "initDB : create view obj_msg_vault_v")
|
||||||
log.Println("initDB : obj_msg_vault_v created ...")
|
log.Println("initDB : obj_msg_vault_v created ...")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user