This commit is contained in:
shoopea 2019-07-08 11:44:23 +08:00
parent 5c6a38c7b9
commit f110275228

7
sql.go
View File

@ -341,6 +341,13 @@ 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 ...")
_, err = db.Exec(`CREATE VIEW obj_name_v AS
SELECT obn.*
.obn.name COLLATE utf8mb4_unicode_ci AS text
FROM obj_name obn;`)
failOnError(err, "initDB : create view obj_name_v")
log.Println("initDB : obj_name_v created ...")
_, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name) _, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name)
VALUES (` + strconv.Itoa(objTypeUser) + `, "user", "User") VALUES (` + strconv.Itoa(objTypeUser) + `, "user", "User")
,(` + strconv.Itoa(objTypeGuild) + `, "guild", "Guild") ,(` + strconv.Itoa(objTypeGuild) + `, "guild", "Guild")