20260629154839

This commit is contained in:
oneao committed 2026-06-29 15:48:39 +08:00
1 parent e687846eb4
commit bb596f3245
41 files changed
+5735 -86

No files matched your search

@@ -0,0 +1,66 @@
package main
import (
"context"
"fmt"
"os"
"time"
"allapp-go/internal/bootstrap/boots"
"allapp-go/internal/config"
)
func main() {
cfg, err := config.Load()
if err != nil {
exitErr("load config", err)
}
pool, err := boots.InitPgsql(cfg)
if err != nil {
exitErr("connect postgres", err)
}
defer pool.Close()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
rows, err := pool.Query(ctx, `
select table_name, column_name
from information_schema.columns
where table_schema = 'public'
and table_name in (
'b_finance_category_default',
'b_finance_category',
'b_clothing_clothes',
'b_clothing_outfit'
)
and column_name in ('icon_mime', 'image_mime', 'cover_mime')
order by table_name, column_name
`)
if err != nil {
exitErr("query columns", err)
}
defer rows.Close()
count := 0
for rows.Next() {
var tableName string
var columnName string
if err := rows.Scan(&tableName, &columnName); err != nil {
exitErr("scan column", err)
}
count++
fmt.Printf("%s.%s\n", tableName, columnName)
}
if err := rows.Err(); err != nil {
exitErr("read rows", err)
}
fmt.Printf("removed_mime_columns_remaining=%d\n", count)
}
func exitErr(step string, err error) {
fmt.Fprintf(os.Stderr, "%s failed: %v\n", step, err)
os.Exit(1)
}