36 lines
988 B
Go
36 lines
988 B
Go
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"fmt"
|
|
"log"
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
)
|
|
|
|
func main() {
|
|
dsn := "root:bindbox2025kdy@tcp(150.158.78.154:3306)/bindbox_game"
|
|
db, err := sql.Open("mysql", dsn)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer db.Close()
|
|
|
|
sqls := []string{
|
|
"ALTER TABLE douyin_orders ADD COLUMN douyin_product_id VARCHAR(128) COMMENT '关联商品ID' AFTER shop_order_id",
|
|
"ALTER TABLE douyin_orders ADD COLUMN product_count BIGINT NOT NULL DEFAULT 1 COMMENT '商品数量' AFTER douyin_product_id",
|
|
"ALTER TABLE douyin_orders ADD COLUMN actual_pay_amount BIGINT DEFAULT 0 COMMENT '实付金额(分)' AFTER actual_receive_amount",
|
|
"ALTER TABLE douyin_orders ADD COLUMN reward_granted INT NOT NULL DEFAULT 0 COMMENT '奖励已发放' AFTER raw_data",
|
|
}
|
|
|
|
for _, s := range sqls {
|
|
fmt.Printf("Executing: %s\n", s)
|
|
_, err := db.Exec(s)
|
|
if err != nil {
|
|
fmt.Printf("Error executing %s: %v\n", s, err)
|
|
} else {
|
|
fmt.Println("Success")
|
|
}
|
|
}
|
|
}
|