From df92d7d31fd469bdd9130d469602bda7f001403e Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 6 Sep 2024 00:13:55 +0800 Subject: [PATCH] 1.2.5 --- Cargo.lock | 2 +- sr_download/Cargo.toml | 2 +- sr_download/src/db_part/defines.rs | 12 +++++++++++- sr_download/src/db_part/defines/main_data_table.rs | 11 ++++++++++- sr_download/src/db_part/defines/ships_table.rs | 8 ++++++++ update.md | 6 ++++++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c8f98d..24ac265 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2590,7 +2590,7 @@ dependencies = [ [[package]] name = "sr_download" -version = "1.2.4" +version = "1.2.5" dependencies = [ "anyhow", "axum", diff --git a/sr_download/Cargo.toml b/sr_download/Cargo.toml index f133bfa..a45b120 100644 --- a/sr_download/Cargo.toml +++ b/sr_download/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sr_download" -version = "1.2.4" +version = "1.2.5" edition = "2021" default-run = "sr_download" diff --git a/sr_download/src/db_part/defines.rs b/sr_download/src/db_part/defines.rs index 2156ca0..178b1d8 100644 --- a/sr_download/src/db_part/defines.rs +++ b/sr_download/src/db_part/defines.rs @@ -20,7 +20,17 @@ pub mod db_names { pub const SEA_ORM_TABLE: &str = "seaql_migrations"; } -pub const CURRENT_DB_VERSION: i32 = 1; +/// 当前数据库版本 (用于检查是否需要更新) +/// +/// ## 版本历史 +/// 1. 原始版本, 基于 sea_orm 的版本 +/// 2. 初始版本, 开始自己写定义了 +/// 各个表的信息可以在对应的文件中查看 +/// - `main_data` 表 +/// - `long_data` 表 +/// - `full_data` 视图 +/// - `ships` 表 +pub const CURRENT_DB_VERSION: i32 = 2; pub const TEXT_DATA_MAX_LEN: usize = 1024; pub type SaveId = u32; diff --git a/sr_download/src/db_part/defines/main_data_table.rs b/sr_download/src/db_part/defines/main_data_table.rs index 631eb4e..063087b 100644 --- a/sr_download/src/db_part/defines/main_data_table.rs +++ b/sr_download/src/db_part/defines/main_data_table.rs @@ -25,7 +25,12 @@ pub fn main_table() -> Statement { .col(ColumnDef::new(MainData::BlakeHash).char_len(64).not_null()) .col(ColumnDef::new(MainData::Len).big_integer().not_null()) .col(ColumnDef::new(MainData::ShortData).string_len(TEXT_DATA_MAX_LEN as u32)) - .col(ColumnDef::new(MainData::XmlTested).boolean().null()); + .col(ColumnDef::new(MainData::XmlTested).boolean().null()) + .col( + ColumnDef::new(MainData::Time) + .timestamp_with_time_zone() + .not_null(), + ); DatabaseBackend::Postgres.build(&table) } @@ -73,4 +78,8 @@ pub enum MainData { ShortData, /// 数据是不是合法的 XML 数据 XmlTested, + /// 加入数据的时间 + /// 用于记录一些有趣的东西 + /// 加入于 版本号 2 + Time, } diff --git a/sr_download/src/db_part/defines/ships_table.rs b/sr_download/src/db_part/defines/ships_table.rs index 482c037..1b297b9 100644 --- a/sr_download/src/db_part/defines/ships_table.rs +++ b/sr_download/src/db_part/defines/ships_table.rs @@ -21,7 +21,15 @@ pub fn ships_table() -> Statement { .from(Ships::Table, Ships::SaveId) .on_delete(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade), + ) + .col(ColumnDef::new(Ships::Mass).big_integer().not_null()) + .col(ColumnDef::new(Ships::ModUsed).boolean().not_null()) + .col( + ColumnDef::new(Ships::DocxConnectionUsed) + .boolean() + .not_null(), ); + // .col(ColumnDef::new(Ships::XmlData)); DatabaseBackend::Postgres.build(&table) } diff --git a/update.md b/update.md index f370162..69db86c 100644 --- a/update.md +++ b/update.md @@ -1,5 +1,11 @@ # v1.0 +## 1.2.5 + +额, 准备迁移到自己写的迁移脚本 +然后遇到了 sea_orm 不支持 xml 类型的问题 +先发一版再说 + ## 1.2.4 又修复了一遍剩下的问题