update backend
This commit is contained in:
@ -39,11 +39,11 @@ func main() {
|
||||
// (a) 参数版:用 $1
|
||||
paramQ := strings.Replace(base, "%s", "$1", 1)
|
||||
fmt.Println("=== (a) 参数版 $1 ===")
|
||||
testQ(db, paramQ, "brand")
|
||||
testQ(db, paramQ, "brands")
|
||||
|
||||
// (b) 内联版:把 'brand' 直接拼进 SQL(模拟 simple-protocol 内联)
|
||||
inlineQ := strings.Replace(base, "%s", "'brand'", 1)
|
||||
fmt.Println("=== (b) 内联版 'brand' ===")
|
||||
// (b) 内联版:把 'brands' 直接拼进 SQL(模拟 simple-protocol 内联)
|
||||
inlineQ := strings.Replace(base, "%s", "'brands'", 1)
|
||||
fmt.Println("=== (b) 内联版 'brands' ===")
|
||||
testQ(db, inlineQ)
|
||||
|
||||
// (c) 去掉 LIKE 表达式的版本(用 is_identity 代替)
|
||||
@ -54,7 +54,7 @@ func main() {
|
||||
COALESCE(c.column_default, ''),
|
||||
(c.is_identity = 'YES')
|
||||
FROM information_schema.columns c
|
||||
WHERE c.table_schema = 'public' AND c.table_name = 'brand'
|
||||
WHERE c.table_schema = 'public' AND c.table_name = 'brands'
|
||||
ORDER BY c.ordinal_position`
|
||||
fmt.Println("=== (c) 去掉 LIKE 表达式版 ===")
|
||||
testQ(db, noLike)
|
||||
|
||||
20611
cmd/dbtool/db_dump.json
20611
cmd/dbtool/db_dump.json
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -67,10 +67,14 @@ func main() {
|
||||
log.Printf("! 关闭数据库连接失败: %v", err)
|
||||
}
|
||||
}()
|
||||
// 2.5 幂等自动迁移表结构(替代原手写 MySQL 迁移脚本)
|
||||
// 2.5 幂等自动迁移表结构(替代原手写旧迁移脚本)
|
||||
if err := database.AutoMigrate(db); err != nil {
|
||||
log.Fatalf("✗ 自动迁移失败: %v", err)
|
||||
}
|
||||
// 2.6 确保去重所需的 HNSW 索引与语义 embedding 表(幂等,随启动重复执行)。
|
||||
if err := database.EnsureDedupSchema(db); err != nil {
|
||||
log.Fatalf("✗ 去重 schema 初始化失败: %v", err)
|
||||
}
|
||||
log.Println("✓ PostgreSQL 已连接:", cfg.Database.Addr())
|
||||
|
||||
// 3. 确保上传目录存在(静态文件服务的根目录)
|
||||
|
||||
Reference in New Issue
Block a user