feat: complete IM P0 and P1 reliability work

This commit is contained in:
richjohnrambo
2026-08-17 13:43:27 +08:00
parent ddf0f7a55e
commit f2c229135b
43 changed files with 4512 additions and 1181 deletions
+8 -1
View File
@@ -24,6 +24,13 @@ func main() {
if err = db.Ping(); err != nil {
fatal(err)
}
var schema string
if err = db.QueryRow("SELECT DATABASE()").Scan(&schema); err != nil {
fatal(err)
}
if strings.TrimSpace(schema) == "" {
fatal("IM_MYSQL_DSN must select a tenant database")
}
raw, err := os.ReadFile("docs/IM-群聊业务表设计.sql")
if err != nil {
@@ -39,7 +46,7 @@ func main() {
fatal(fmt.Errorf("exec failed: %s: %w", stmt, err))
}
}
fmt.Println("group business tables applied")
fmt.Printf("group business tables applied to %s\n", schema)
}
func stripSQLLineComments(text string) string {
+8 -1
View File
@@ -24,6 +24,13 @@ func main() {
if err = db.Ping(); err != nil {
fatal(err)
}
var schema string
if err = db.QueryRow("SELECT DATABASE()").Scan(&schema); err != nil {
fatal(err)
}
if strings.TrimSpace(schema) == "" {
fatal("IM_MYSQL_DSN must select a tenant database")
}
tables := []string{
"im_group_settings",
@@ -41,7 +48,7 @@ func main() {
}
for _, table := range tables {
var count int
err = db.QueryRow(`SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='tinode' AND TABLE_NAME=?`, table).Scan(&count)
err = db.QueryRow(`SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA=? AND TABLE_NAME=?`, schema, table).Scan(&count)
if err != nil {
fatal(err)
}