From 4fd115dfb1a3b3c79cc573677c1d8a95c226949b Mon Sep 17 00:00:00 2001 From: v-me-50 Date: Fri, 18 Jul 2025 11:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=A6=96=E6=AC=A1=E5=AE=89=E8=A3=85=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/public/sqlite_migrate/migrate_table_to_db.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/public/sqlite_migrate/migrate_table_to_db.go b/backend/public/sqlite_migrate/migrate_table_to_db.go index 692d3f6..0d703d9 100644 --- a/backend/public/sqlite_migrate/migrate_table_to_db.go +++ b/backend/public/sqlite_migrate/migrate_table_to_db.go @@ -116,14 +116,14 @@ func MigrateSQLiteTable(sourceDBPath, sourceTable, targetDBPath, targetTable str // 创建目标表 //fmt.Printf("目标表 %s 不存在,正在创建...\n", targetTable) if _, err := targetDB.Exec(createTableSQL); err != nil { - //return fmt.Errorf("创建目标表失败: %v", err) + return fmt.Errorf("创建目标表失败: %v", err) } fmt.Printf("目标表 %s 创建成功。\n", targetTable) // 打开源数据库 sourceDB, err := sql.Open("sqlite", sourceDBPath) if err != nil { - //return fmt.Errorf("打开源数据库失败: %v", err) + return fmt.Errorf("打开源数据库失败: %v", err) } defer sourceDB.Close() @@ -133,7 +133,7 @@ func MigrateSQLiteTable(sourceDBPath, sourceTable, targetDBPath, targetTable str return err } if !exists { - //return fmt.Errorf("源表 %s 不存在,迁移终止", sourceTable) + return fmt.Errorf("源表 %s 不存在,迁移终止", sourceTable) } // 构建列映射 @@ -144,13 +144,13 @@ func MigrateSQLiteTable(sourceDBPath, sourceTable, targetDBPath, targetTable str rows, err := sourceDB.Query(selectSQL) if err != nil { - //return fmt.Errorf("查询源数据失败: %v", err) + return fmt.Errorf("查询源数据失败: %v", err) } defer rows.Close() stmt, err := targetDB.Prepare(insertSQL) if err != nil { - //return fmt.Errorf("准备插入语句失败: %v", err) + return fmt.Errorf("准备插入语句失败: %v", err) } defer stmt.Close() @@ -166,7 +166,7 @@ func MigrateSQLiteTable(sourceDBPath, sourceTable, targetDBPath, targetTable str } if err := rows.Scan(ptrs...); err != nil { - //return fmt.Errorf("读取行数据失败: %v", err) + return fmt.Errorf("读取行数据失败: %v", err) } batch = append(batch, values)