插入字段 和 创建索引
c :=0
sql =`select count(1) as c from information_schema.columns where table_name = '`+tableName+`' and column_name = 'os_type'`
row :=fun.GameDb.Raw(sql).Row()
row.Scan(&c)
if c==0{
sql :=`alter table `+tableName+` add column os_type varchar(12) default '' comment '系统ios/andirod'`
fmt.Println(sql)
fun.GameDb.Exec(sql)
sql = `alter table `+tableName+` add index in_os_type(os_type) `
fun.GameDb.Exec(sql)
}
网友评论