Skip to content

Commit c3eb44d

Browse files
committed
chore: add v0.13.0 db backup before update to v0.14.0
1 parent 882e237 commit c3eb44d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src-tauri/migration/src/m20251229_000004_hybrid_single_table.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
//!
1717
//! 注意:本迁移要求 SQLite >= 3.35.0 以支持 DROP COLUMN
1818
19+
use crate::backup::backup_sqlite;
20+
use log::{error, info};
1921
use sea_orm::{ConnectionTrait, DatabaseBackend, Statement};
2022
use sea_orm_migration::prelude::*;
2123
use sea_orm_migration::sea_orm::TransactionTrait;
@@ -141,6 +143,15 @@ fn to_json<T: Serialize>(data: &T) -> Result<String, DbErr> {
141143
#[async_trait::async_trait]
142144
impl MigrationTrait for Migration {
143145
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
146+
// ========================================
147+
// 备份数据库
148+
// ========================================
149+
info!("[MIGRATION] Starting database backup before hybrid single table migration...");
150+
match backup_sqlite("v0.13.0").await {
151+
Ok(backup_path) => info!("[MIGRATION] Backup successful: {:?}", backup_path),
152+
Err(e) => error!("[MIGRATION] Backup failed (continuing anyway): {}", e),
153+
}
154+
144155
let conn = manager.get_connection();
145156

146157
// 幂等性检查:如果已存在 vndb_data 列则跳过

0 commit comments

Comments
 (0)