29 lines
654 B
Go
29 lines
654 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"gorm.io/driver/mysql"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const (
|
|
DbDSN = "root:bindbox2025kdy@tcp(150.158.78.154:3306)/dev_game?charset=utf8mb4&parseTime=True&loc=Local"
|
|
)
|
|
|
|
func main() {
|
|
db, err := gorm.Open(mysql.Open(DbDSN), &gorm.Config{})
|
|
if err != nil {
|
|
log.Fatalf("DB connection failed: %v", err)
|
|
}
|
|
|
|
fmt.Println("Checking indexes on cloud DB...")
|
|
var results []map[string]interface{}
|
|
db.Raw("SHOW INDEX FROM order_coupons;").Scan(&results)
|
|
for _, res := range results {
|
|
fmt.Printf("Table: %s, Key_name: %s, Column: %s, Unique: %v\n",
|
|
res["Table"], res["Key_name"], res["Column_name"], res["Non_unique"])
|
|
}
|
|
}
|