fix sql views
This commit is contained in:
parent
10a4d4bdb9
commit
2ca76c6974
3
obj.go
3
obj.go
@ -78,6 +78,9 @@ func initCache(initDB bool) {
|
|||||||
log.Println("Caching clients ..")
|
log.Println("Caching clients ..")
|
||||||
err = loadClients()
|
err = loadClients()
|
||||||
|
|
||||||
|
log.Println("Recreating SQL views ..")
|
||||||
|
initDBViews()
|
||||||
|
|
||||||
if initDB {
|
if initDB {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
289
sql.go
289
sql.go
@ -144,13 +144,6 @@ func initDB() {
|
|||||||
failOnError(err, "initDB : create table obj_user")
|
failOnError(err, "initDB : create table obj_user")
|
||||||
log.Println("initDB : obj_user created ...")
|
log.Println("initDB : obj_user created ...")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE VIEW obj_user_v AS
|
|
||||||
SELECT ou.obj_id
|
|
||||||
,ou.name COLLATE utf8mb4_unicode_ci AS name
|
|
||||||
FROM obj_user ou;`)
|
|
||||||
failOnError(err, "initDB : create view obj_user_v")
|
|
||||||
log.Println("initDB : obj_user_v created ...")
|
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE TABLE obj_war (
|
_, err = db.Exec(`CREATE TABLE obj_war (
|
||||||
obj_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
|
obj_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
,start_time DATETIME NOT NULL
|
,start_time DATETIME NOT NULL
|
||||||
@ -174,24 +167,6 @@ func initDB() {
|
|||||||
failOnError(err, "initDB : create table obj_msg")
|
failOnError(err, "initDB : create table obj_msg")
|
||||||
log.Println("initDB : obj_msg created ...")
|
log.Println("initDB : obj_msg created ...")
|
||||||
|
|
||||||
_, 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
|
|
||||||
,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 ...")
|
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE TABLE obj_msg_pillage_inc (
|
_, err = db.Exec(`CREATE TABLE obj_msg_pillage_inc (
|
||||||
obj_id BIGINT UNSIGNED NOT NULL
|
obj_id BIGINT UNSIGNED NOT NULL
|
||||||
,attacker VARCHAR(32)
|
,attacker VARCHAR(32)
|
||||||
@ -338,18 +313,6 @@ 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 COLLATE utf8mb4_unicode_ci AS msg_type
|
|
||||||
FROM msg_rules 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_tribute (
|
_, err = db.Exec(`CREATE TABLE obj_tribute (
|
||||||
obj_id BIGINT UNSIGNED NOT NULL
|
obj_id BIGINT UNSIGNED NOT NULL
|
||||||
,user_id BIGINT UNSIGNED NOT NULL
|
,user_id BIGINT UNSIGNED NOT NULL
|
||||||
@ -437,13 +400,88 @@ func initDB() {
|
|||||||
failOnError(err, "initDB : create table obj_name")
|
failOnError(err, "initDB : create table obj_name")
|
||||||
log.Println("initDB : obj_name created ...")
|
log.Println("initDB : obj_name created ...")
|
||||||
|
|
||||||
|
log.Println("initDB : Database set up")
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDBViews() {
|
||||||
|
tx, err := db.Begin()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
|
_, err = tx.Exec("set foreign_key_checks = 0")
|
||||||
|
failOnError(err, "initDBViews : set foreign_key_checks = 0")
|
||||||
|
|
||||||
|
var name string
|
||||||
|
rows, err := db.Query("show tables")
|
||||||
|
failOnError(err, "initDBViews : show tables")
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
err = rows.Scan(&name)
|
||||||
|
failOnError(err, "initDBViews : show tables listing")
|
||||||
|
|
||||||
|
if ok, _ := regexp.MatchString(`^.*_v$`, name); ok {
|
||||||
|
_, err = tx.Exec("drop view " + name)
|
||||||
|
failOnError(err, "initDBViews : drop view "+name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = rows.Err()
|
||||||
|
failOnError(err, "initDBViews : show tables listing end")
|
||||||
|
rows.Close()
|
||||||
|
|
||||||
|
_, err = tx.Exec("set foreign_key_checks = 1")
|
||||||
|
failOnError(err, "initDBViews : set foreign_key_checks = 1")
|
||||||
|
|
||||||
|
err = tx.Commit()
|
||||||
|
failOnError(err, "initDBViews : commit cleanup")
|
||||||
|
|
||||||
|
log.Println("initDBViews : Views cleaned up")
|
||||||
|
|
||||||
|
_, err = db.Exec(`CREATE VIEW obj_user_v AS
|
||||||
|
SELECT ou.obj_id
|
||||||
|
,ou.name COLLATE utf8mb4_unicode_ci AS name
|
||||||
|
FROM obj_user ou;`)
|
||||||
|
failOnError(err, "initDBViews : create view obj_user_v")
|
||||||
|
log.Println("initDBViews : obj_user_v created ...")
|
||||||
|
|
||||||
|
_, 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
|
||||||
|
,obj o
|
||||||
|
,code_obj_sub_type cost
|
||||||
|
WHERE om.obj_id = o.id
|
||||||
|
AND cost.id = o.obj_sub_type_id;`)
|
||||||
|
failOnError(err, "initDBViews : create view obj_msg_v")
|
||||||
|
log.Println("initDBViews : obj_msg_v 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 COLLATE utf8mb4_unicode_ci AS msg_type
|
||||||
|
FROM msg_rules r
|
||||||
|
,code_obj_sub_type cost
|
||||||
|
WHERE cost.id = r.msg_type_id;`)
|
||||||
|
failOnError(err, "initDBViews : create table msg_rules_v")
|
||||||
|
log.Println("initDBViews : msg_rules_v created ...")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE VIEW obj_name_v AS
|
_, err = db.Exec(`CREATE VIEW obj_name_v AS
|
||||||
SELECT obn.obj_id
|
SELECT obn.obj_id
|
||||||
,obn.name COLLATE utf8mb4_unicode_ci AS name
|
,obn.name COLLATE utf8mb4_unicode_ci AS name
|
||||||
,obn.priority
|
,obn.priority
|
||||||
FROM obj_name obn;`)
|
FROM obj_name obn;`)
|
||||||
failOnError(err, "initDB : create view obj_name_v")
|
failOnError(err, "initDBViews : create view obj_name_v")
|
||||||
log.Println("initDB : obj_name_v created ...")
|
log.Println("initDBViews : obj_name_v created ...")
|
||||||
|
|
||||||
_, err = db.Exec(`CREATE VIEW obj_item_name_v AS
|
_, err = db.Exec(`CREATE VIEW obj_item_name_v AS
|
||||||
SELECT obi.obj_id
|
SELECT obi.obj_id
|
||||||
@ -454,171 +492,8 @@ func initDB() {
|
|||||||
,obj_item obi
|
,obj_item obi
|
||||||
WHERE obi.obj_id = obn.obj_id
|
WHERE obi.obj_id = obn.obj_id
|
||||||
ORDER BY obi.intl_id ASC;`)
|
ORDER BY obi.intl_id ASC;`)
|
||||||
failOnError(err, "initDB : create view obj_item_name_v")
|
failOnError(err, "initDBViews : create view obj_item_name_v")
|
||||||
log.Println("initDB : obj_item_name_v created ...")
|
log.Println("initDBViews : obj_item_name_v created ...")
|
||||||
/*
|
|
||||||
_, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name)
|
|
||||||
VALUES (` + strconv.Itoa(cacheObjType[`user`]) + `, "user", "User")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`guild`]) + `, "guild", "Guild")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`msg`]) + `, "msg", "Message")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`war`]) + `, "war", "War")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`war_report`]) + `, "war_report", "War Report")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`job`]) + `, "job", "Job")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`item`]) + `, "item", "Item")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`castle`]) + `, "castle", "Castle")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`fair`]) + `, "fair", "Fair")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`union`]) + `, "union", "Trade Union")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`tribute`]) + `, "tribute", "Tribute")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`xp`]) + `, "xp", "Experience")
|
|
||||||
,(` + strconv.Itoa(cacheObjType[`quest`]) + `, "quest", "Quest")
|
|
||||||
;`)
|
|
||||||
failOnError(err, "initDB : populate table code_obj_type")
|
|
||||||
log.Println("initDB : code_obj_type populated ...")
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
_, err = db.Exec(`INSERT INTO code_obj_sub_type (id, intl_id, name, obj_type_id)
|
|
||||||
VALUES (` + strconv.Itoa(cacheObjSubType[`user`]) + `, "user", "User", ` + strconv.Itoa(cacheObjType[`user`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`guild`]) + `, "guild", "Guild", ` + strconv.Itoa(cacheObjType[`guild`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg`]) + `, "unknown", "Unknown", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_war`]) + `, "war", "War report", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_guild_war`]) + `, "guild_war", "Guilds war report", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_report_req`]) + `, "report_req", "Player war report request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_report_ack`]) + `, "report_ack", "Player war report ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_g_report_req`]) + `, "g_report_req", "Player guilds war report request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_g_report_ack`]) + `, "g_report_ack", "Player guilds war report ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_quest_res`]) + `, "quest_res", "Quest result", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_quest_res_ambush`]) + `, "quest_res_ambush", "Quest result with Ambush", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_duel_fight`]) + `, "duel_fight", "Duel fight result", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_hero_req`]) + `, "hero_req", "Hero summary request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_hero_ack`]) + `, "hero_ack", "Hero summary ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_me_req`]) + `, "me_req", "Hero short summary request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_me_ack`]) + `, "me_ack", "Hero short summary ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_inv_req`]) + `, "inv_req", "Inventory request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_inv_ack`]) + `, "inv_ack", "Inventory ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_inc`]) + `, "pillage_inc", "Pillage incoming", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_go`]) + `, "pillage_go", "Pillage go", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_timeout`]) + `, "pillage_timeout", "Pillage timeout", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_win`]) + `, "pillage_win", "Pillage win", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_loss`]) + `, "pillage_loss", "Pillage loss", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_tribute_inc`]) + `, "tribute_inc", "Tribute incoming", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_tribute_ack`]) + `, "tribute_ack", "Tribute acknowledged", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_auction_announce`]) + `, "auction_announce", "Auction announce", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_auction_upd_req`]) + `, "auction_upd_req", "Auction update request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_auction_upd_ack`]) + `, "auction_upd_ack", "Auction update acknowledgment", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_time_ack`]) + `, "time_ack", "Time Acknowledgment", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_time_req`]) + `, "time_req", "Time Request", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_go`]) + `, "go", "Go", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pledge`]) + `, "pledge", "Pledge", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_go_quest_req`]) + `, "go_quest_req", "Go quest Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_fast_fight`]) + `, "fast_fight", "Arena fast fight", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_go_arena`]) + `, "go_arena", "Go arena", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_top`]) + `, "top", "Top", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_menu`]) + `, "menu", "Menu", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_buy_req`]) + `, "buy_req", "Sell Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_sell_req`]) + `, "sell_req", "Buy Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_orderbook_req`]) + `, "orderbook_req", "Orderbook Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_orderbook_acl`]) + `, "orderbook_acl", "Orderbook Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_withdraw_req`]) + `, "withdraw_req", "Withdraw Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_withdraw_code`]) + `, "withdraw_code", "Withdraw Code", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_withdraw_rcv`]) + `, "withdraw_rcv", "Withdraw Received", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_stock_req`]) + `, "stock_req", "Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_stock_ack`]) + `, "stock_ack", "Stock Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_misc_req`]) + `, "misc_req", "Misc Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_misc_ack`]) + `, "misc_ack", "Misc Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_tureport_req`]) + `, "tureport_req", "Trade Union War Report Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_tureport_ack`]) + `, "tureport_ack", "Trade Union War Report Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_union_war`]) + `, "union_war", "Union war report", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_timeout`]) + `, "timeout", "Generic timeout", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_go_quest_ack`]) + `, "go_quest_ack", "Go Quest Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_groles_req`]) + `, "groles_req", "Guild roles Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_groles_ack`]) + `, "groles_ack", "Guild roles Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_res_req`]) + `, "gstock_res_req", "GStock Res Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_alch_req`]) + `, "gstock_alch_req", "GStock Alch Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_misc_req`]) + `, "gstock_misc_req", "GStock Misc Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_rec_req`]) + `, "gstock_rec_req", "GStock Rec Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_part_req`]) + `, "gstock_part_req", "GStock Part Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_oth_req`]) + `, "gstock_oth_req", "Gstock Oth Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_any_ack`]) + `, "gstock_any_ack", "Gstock Any Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_req`]) + `, "gstock_req", "GStock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_gstock_ack`]) + `, "gstock_ack", "GStock Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_busy`]) + `, "busy", "Busy", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_res_stock_req`]) + `, "res_stock_req", "Resources Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_alch_stock_req`]) + `, "alch_stock_req", "Alchemy Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_misc_stock_req`]) + `, "misc_stock_req", "Misc Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_equip_stock_req`]) + `, "equip_stock_req", "Equipment Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_craft_stock_req`]) + `, "craft_stock_req", "Equipment Stock Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_stock_empty`]) + `, "stock_empty", "Stock Empty", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_stock_any_ack`]) + `, "stock_any_ack", "Stock Any Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_g_deposit_req`]) + `, "g_deposit_req", "GDeposit Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_g_deposit_ack`]) + `, "g_deposit_ack", "GDeposit Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_attack_req`]) + `, "castle_attack_req", "Castle Attack Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_attack_ack`]) + `, "castle_attack_ack", "Castle Attack Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_target_req`]) + `, "castle_target_req", "Castle Target Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_target_ack`]) + `, "castle_target_ack", "Castle Target Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_def_req`]) + `, "castle_def_req", "Castle Defense Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_def_ack`]) + `, "castle_def_ack", "Castle Defense Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_back`]) + `, "back", "Back", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_req`]) + `, "castle_req", "Castle Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_castle_ack`]) + `, "castle_ack", "Castle Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_exchange_req`]) + `, "exchange_req", "Exchange Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_exchange_ack`]) + `, "exchange_ack", "Exchange Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_equip_req`]) + `, "equip_req", "Equip Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_equip_ack`]) + `, "equip_ack", "Equip Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_unequip_req`]) + `, "unequip_req", "Unequip Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_unequip_ack`]) + `, "unequip_ack", "Unequip Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_no_stamina`]) + `, "no_stamina", "No Stamina", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_orderbook_search`]) + `, "orderbook_search", "Orderbook search", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_quest_req`]) + `, "quest_req", "Quest Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_quest_ack`]) + `, "quest_ack", "Quest Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_battle`]) + `, "battle", "Battle", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_order_cancel_req`]) + `, "order_cancel_req", "Order Cancel Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_order_cancel_ack`]) + `, "order_cancel_ack", "Order Cancel Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_stamina_restored`]) + `, "stamina_restored", "Stamina Restored", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_heal_up`]) + `, "heal_up", "Heal Up", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_arena_fight_ack`]) + `, "arena_fight_ack", "Arena Fight Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_go_arena`]Ack) + `, "go_arena_ack", "Go Arena Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_withdraw_nack`]) + `, "withdraw_nack", "Withdraw NAck", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_pillage_defeat`]) + `, "pillage_defeat", "Pillage Defeat", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_req`]) + `, "level_up_req", "Level Up Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_ack`]) + `, "level_up_ack", "Level Up Ack", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`msg_top`]Req) + `, "top_req", "Top Req", ` + strconv.Itoa(cacheObjType[`msg`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_pillage`]) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_tribute`]) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_gwithdraw`]) + `, "job_gwithdraw", "GWithdrawal job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_gstock`]) + `, "job_gstock", "GStock job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_rescan_msg`]) + `, "job_rescan_msg", "Rescan message job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_set_done`]) + `, "job_set_done", "Set job as done job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_msg_client`]) + `, "job_msg_client", "Send message via client", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_msg_refresh`]) + `, "job_msg_refresh", "Refresh message from client", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_backup_export`]) + `, "job_backup_export", "Export Backup", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_backup_import`]) + `, "job_backup_import", "Import Backup", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_gdeposit`]) + `, "job_gdeposit", "GDeposit job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_gdeposit_fwd`]) + `, "job_gdeposit_fwd", "GDeposit Forward job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_save_res`]) + `, "job_save_res", "Save resources job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_vault_user_status`]) + `, "job_vault_user_status", "Vault User Status job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_vault_item_status`]) + `, "job_vault_item_status", "Vault Item Status job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_msg_fwd`]) + `, "job_fwd_msg", "Forward Message job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_set_def`]) + `, "job_set_def", "Set Defense job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_msg_del`]) + `, "job_msg_del", "Msg Del job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`job_get_hammer_time`]) + `, "job_get_hammer_time", "Get Hammer Time job", ` + strconv.Itoa(cacheObjType[`job`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_res`]) + `, "item_res", "Resource", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_alch`]) + `, "item_alch", "Alchemy", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_misc`]) + `, "item_misc", "Miscelaneous", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_recipe`]) + `, "item_recipe", "Recipe", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_part`]) + `, "item_part", "Part", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`item_other`]) + `, "item_other", "Other", ` + strconv.Itoa(cacheObjType[`item`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`castle`]) + `, "castle", "Castle", ` + strconv.Itoa(cacheObjType[`castle`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`union`]) + `, "union", "Union", ` + strconv.Itoa(cacheObjType[`union`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`fair`]) + `, "fair", "Fair", ` + strconv.Itoa(cacheObjType[`fair`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`tribute`]) + `, "tribute", "Tribute", ` + strconv.Itoa(cacheObjType[`tribute`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`xp`]) + `, "xp", "Experience", ` + strconv.Itoa(cacheObjType[`xp`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`quest_forest`]) + `, "forest", "Forest", ` + strconv.Itoa(cacheObjType[`quest`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`quest_swamp`]) + `, "swamp", "Swamp", ` + strconv.Itoa(cacheObjType[`quest`]) + `)
|
|
||||||
,(` + strconv.Itoa(cacheObjSubType[`quest_valley`]) + `, "valley", "Valley", ` + strconv.Itoa(cacheObjType[`quest`]) + `)
|
|
||||||
;`)
|
|
||||||
failOnError(err, "initDB : populate table code_obj_sub_type")
|
|
||||||
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 obm.sender_user_id user_id
|
SELECT obm.sender_user_id user_id
|
||||||
@ -638,10 +513,10 @@ func initDB() {
|
|||||||
AND oi.id = omi.item_id
|
AND oi.id = omi.item_id
|
||||||
ORDER BY obm.sender_user_id ASC
|
ORDER BY obm.sender_user_id ASC
|
||||||
,omi.item_id ASC;`)
|
,omi.item_id ASC;`)
|
||||||
failOnError(err, "initDB : create view obj_msg_vault_v")
|
failOnError(err, "initDBViews : create view obj_msg_vault_v")
|
||||||
log.Println("initDB : obj_msg_vault_v created ...")
|
log.Println("initDBViews : obj_msg_vault_v created ...")
|
||||||
|
|
||||||
log.Println("initDB : Database set up")
|
log.Println("initDBViews : Views set up")
|
||||||
}
|
}
|
||||||
|
|
||||||
func insertObjType(intlId string, name string) error {
|
func insertObjType(intlId string, name string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user