From f5ab89e19790dc2227b73a3b82f7e7b31b0d3244 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 19:34:16 +0000 Subject: [PATCH 1/2] Update sea-orm requirement from 0.12.15 to 1.0.0 Updates the requirements on [sea-orm](https://github.com/SeaQL/sea-orm) to permit the latest version. - [Release notes](https://github.com/SeaQL/sea-orm/releases) - [Changelog](https://github.com/SeaQL/sea-orm/blob/0.12.15/CHANGELOG.md) - [Commits](https://github.com/SeaQL/sea-orm/compare/0.12.15...0.12.15) --- updated-dependencies: - dependency-name: sea-orm dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b5a60fbd3..4962aa54a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ axum-extra = "0.9.3" tower-http = "0.5.2" tower = "0.4.13" hex = "0.4.3" -sea-orm = "0.12.15" +sea-orm = "1.0.0" flate2 = "1.0.30" bstr = "1.9.1" colored = "2.1.0" From 9316ef9d5d157fa1c6348cd6f8d6d017a1ecb099 Mon Sep 17 00:00:00 2001 From: "benjamin.747" Date: Mon, 5 Aug 2024 10:37:41 +0800 Subject: [PATCH 2/2] upgrade sea-orm to 1.0.0, regenerate sea-orm entity by cli --- ceres/src/lfs/handler.rs | 4 +- docs/database.md | 2 +- jupiter/callisto/src/db_enums.rs | 46 +++++++++---------- jupiter/callisto/src/git_blob.rs | 6 +-- jupiter/callisto/src/git_commit.rs | 5 +- jupiter/callisto/src/git_issue.rs | 2 +- jupiter/callisto/src/git_pr.rs | 2 +- jupiter/callisto/src/git_repo.rs | 2 +- jupiter/callisto/src/git_tag.rs | 2 +- jupiter/callisto/src/git_tree.rs | 3 +- jupiter/callisto/src/import_refs.rs | 2 +- jupiter/callisto/src/lfs_locks.rs | 2 +- jupiter/callisto/src/lfs_objects.rs | 2 +- ...lit_relation.rs => lfs_split_relations.rs} | 4 +- jupiter/callisto/src/lib.rs | 4 +- jupiter/callisto/src/mega_blob.rs | 4 +- jupiter/callisto/src/mega_commit.rs | 5 +- jupiter/callisto/src/mega_issue.rs | 2 +- jupiter/callisto/src/mega_mr.rs | 2 +- jupiter/callisto/src/mega_mr_comment.rs | 4 +- jupiter/callisto/src/mega_mr_conv.rs | 2 +- jupiter/callisto/src/mega_refs.rs | 5 +- jupiter/callisto/src/mega_tag.rs | 2 +- jupiter/callisto/src/mega_tree.rs | 3 +- jupiter/callisto/src/prelude.rs | 9 ++-- jupiter/callisto/src/raw_blob.rs | 6 +-- jupiter/src/storage/lfs_storage.rs | 24 +++++----- mercury/src/internal/model/blob.rs | 2 +- 28 files changed, 80 insertions(+), 78 deletions(-) rename jupiter/callisto/src/{lfs_split_relation.rs => lfs_split_relations.rs} (82%) diff --git a/ceres/src/lfs/handler.rs b/ceres/src/lfs/handler.rs index 64df64795..ac7ff226a 100644 --- a/ceres/src/lfs/handler.rs +++ b/ceres/src/lfs/handler.rs @@ -8,7 +8,7 @@ use chrono::{prelude::*, Duration}; use jupiter::storage::lfs_storage::LfsStorage; use rand::prelude::*; -use callisto::{lfs_locks, lfs_objects, lfs_split_relation}; +use callisto::{lfs_locks, lfs_objects, lfs_split_relations}; use common::errors::{GitLFSError, MegaError}; use crate::lfs::lfs_structs::{ @@ -763,7 +763,7 @@ async fn lfs_put_relation( offset: i64, size: i64, ) -> Result<(), GitLFSError> { - let relation = lfs_split_relation::Model { + let relation = lfs_split_relations::Model { ori_oid: ori_oid.to_owned(), sub_oid: sub_oid.to_owned(), offset, diff --git a/docs/database.md b/docs/database.md index 68089e798..9f5d55b2e 100644 --- a/docs/database.md +++ b/docs/database.md @@ -386,4 +386,4 @@ erDiagram - Generating entities: Entities can be generated from the database table structure with the following command -`sea-orm-cli generate entity -u "postgres://postgres:$postgres@localhost/mega_re" -o jupiter/entity/src` \ No newline at end of file +`sea-orm-cli generate entity -u "postgres://postgres:$postgres@localhost/mega" -o jupiter/entity/src` \ No newline at end of file diff --git a/jupiter/callisto/src/db_enums.rs b/jupiter/callisto/src/db_enums.rs index 793d642bb..4f4110e1a 100644 --- a/jupiter/callisto/src/db_enums.rs +++ b/jupiter/callisto/src/db_enums.rs @@ -1,16 +1,18 @@ use core::fmt; use std::fmt::Display; +use sea_orm::prelude::StringLen; use sea_orm::{DeriveActiveEnum, EnumIter}; #[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] -#[sea_orm(rs_type = "String", db_type = "String(Some(1))")] +#[sea_orm( + rs_type = "String", + db_type = "String(StringLen::None)", + rename_all = "snake_case" +)] pub enum StorageType { - #[sea_orm(string_value = "database")] Database, - #[sea_orm(string_value = "local_fs")] LocalFs, - #[sea_orm(string_value = "remote_url")] RemoteUrl, } @@ -24,15 +26,15 @@ impl fmt::Display for StorageType { } } - #[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum, Copy)] -#[sea_orm(rs_type = "String", db_type = "String(Some(1))")] +#[sea_orm( + rs_type = "String", + db_type = "String(StringLen::None)", + rename_all = "snake_case" +)] pub enum MergeStatus { - #[sea_orm(string_value = "open")] Open, - #[sea_orm(string_value = "merged")] Merged, - #[sea_orm(string_value = "closed")] Closed, } @@ -48,35 +50,31 @@ impl Display for MergeStatus { } #[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] -#[sea_orm(rs_type = "String", db_type = "String(Some(1))")] +#[sea_orm( + rs_type = "String", + db_type = "String(StringLen::None)", + rename_all = "snake_case" +)] pub enum RefType { - #[sea_orm(string_value = "branch")] Branch, - #[sea_orm(string_value = "tag")] Tag, } - #[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] -#[sea_orm(rs_type = "String", db_type = "String(Some(1))")] +#[sea_orm( + rs_type = "String", + db_type = "String(StringLen::None)", + rename_all = "snake_case" +)] pub enum ConvType { - #[sea_orm(string_value = "comment")] Comment, - #[sea_orm(string_value = "deploy")] Deploy, - #[sea_orm(string_value = "commit")] Commit, - #[sea_orm(string_value = "forse_push")] ForcePush, - #[sea_orm(string_value = "edit")] - Edit, - #[sea_orm(string_value = "review")] + Edit, Review, - #[sea_orm(string_value = "approve")] Approve, - #[sea_orm(string_value = "merge_queue")] MergeQueue, - #[sea_orm(string_value = "merged")] Merged, } diff --git a/jupiter/callisto/src/git_blob.rs b/jupiter/callisto/src/git_blob.rs index cdad257e5..c56c926ee 100644 --- a/jupiter/callisto/src/git_blob.rs +++ b/jupiter/callisto/src/git_blob.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -9,9 +9,9 @@ pub struct Model { pub id: i64, pub repo_id: i64, pub blob_id: String, - pub commit_id: String, - pub name: String, + pub name: Option, pub size: i32, + pub commit_id: String, pub created_at: DateTime, } diff --git a/jupiter/callisto/src/git_commit.rs b/jupiter/callisto/src/git_commit.rs index 89b4aa5f2..a04533545 100644 --- a/jupiter/callisto/src/git_commit.rs +++ b/jupiter/callisto/src/git_commit.rs @@ -1,7 +1,6 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; -use serde_json::Value; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "git_commit")] @@ -11,7 +10,7 @@ pub struct Model { pub repo_id: i64, pub commit_id: String, pub tree: String, - pub parents_id: Value, + pub parents_id: Json, #[sea_orm(column_type = "Text", nullable)] pub author: Option, #[sea_orm(column_type = "Text", nullable)] diff --git a/jupiter/callisto/src/git_issue.rs b/jupiter/callisto/src/git_issue.rs index 4d4662640..e13da1bed 100644 --- a/jupiter/callisto/src/git_issue.rs +++ b/jupiter/callisto/src/git_issue.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/git_pr.rs b/jupiter/callisto/src/git_pr.rs index f945fe518..772c27878 100644 --- a/jupiter/callisto/src/git_pr.rs +++ b/jupiter/callisto/src/git_pr.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/git_repo.rs b/jupiter/callisto/src/git_repo.rs index d9f601bdf..61de4d7b3 100644 --- a/jupiter/callisto/src/git_repo.rs +++ b/jupiter/callisto/src/git_repo.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/git_tag.rs b/jupiter/callisto/src/git_tag.rs index cb06b65df..6d1b271a2 100644 --- a/jupiter/callisto/src/git_tag.rs +++ b/jupiter/callisto/src/git_tag.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/git_tree.rs b/jupiter/callisto/src/git_tree.rs index 8bbbac769..0672d44fe 100644 --- a/jupiter/callisto/src/git_tree.rs +++ b/jupiter/callisto/src/git_tree.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -9,6 +9,7 @@ pub struct Model { pub id: i64, pub repo_id: i64, pub tree_id: String, + #[sea_orm(column_type = "VarBinary(StringLen::None)")] pub sub_trees: Vec, pub size: i32, pub commit_id: String, diff --git a/jupiter/callisto/src/import_refs.rs b/jupiter/callisto/src/import_refs.rs index 0b2151247..f90719b6f 100644 --- a/jupiter/callisto/src/import_refs.rs +++ b/jupiter/callisto/src/import_refs.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/lfs_locks.rs b/jupiter/callisto/src/lfs_locks.rs index c79236778..02aa13fb6 100644 --- a/jupiter/callisto/src/lfs_locks.rs +++ b/jupiter/callisto/src/lfs_locks.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/lfs_objects.rs b/jupiter/callisto/src/lfs_objects.rs index c2a51b8f4..9555d099f 100644 --- a/jupiter/callisto/src/lfs_objects.rs +++ b/jupiter/callisto/src/lfs_objects.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/lfs_split_relation.rs b/jupiter/callisto/src/lfs_split_relations.rs similarity index 82% rename from jupiter/callisto/src/lfs_split_relation.rs rename to jupiter/callisto/src/lfs_split_relations.rs index aa3575cab..108bb7d13 100644 --- a/jupiter/callisto/src/lfs_split_relation.rs +++ b/jupiter/callisto/src/lfs_split_relations.rs @@ -1,3 +1,5 @@ +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 + use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] @@ -15,4 +17,4 @@ pub struct Model { #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} -impl ActiveModelBehavior for ActiveModel {} \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/jupiter/callisto/src/lib.rs b/jupiter/callisto/src/lib.rs index 445fd8195..ebd858ac6 100644 --- a/jupiter/callisto/src/lib.rs +++ b/jupiter/callisto/src/lib.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 pub mod prelude; @@ -13,7 +13,7 @@ pub mod git_tree; pub mod import_refs; pub mod lfs_locks; pub mod lfs_objects; -pub mod lfs_split_relation; +pub mod lfs_split_relations; pub mod mega_blob; pub mod mega_commit; pub mod mega_issue; diff --git a/jupiter/callisto/src/mega_blob.rs b/jupiter/callisto/src/mega_blob.rs index 60900a043..4ccd382e7 100644 --- a/jupiter/callisto/src/mega_blob.rs +++ b/jupiter/callisto/src/mega_blob.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -7,9 +7,9 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: i64, - #[sea_orm(unique)] pub blob_id: String, pub commit_id: String, + #[sea_orm(column_type = "Text")] pub name: String, pub size: i32, pub created_at: DateTime, diff --git a/jupiter/callisto/src/mega_commit.rs b/jupiter/callisto/src/mega_commit.rs index 9c54ef085..65286abc4 100644 --- a/jupiter/callisto/src/mega_commit.rs +++ b/jupiter/callisto/src/mega_commit.rs @@ -1,7 +1,6 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; -use serde_json::Value; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "mega_commit")] @@ -11,7 +10,7 @@ pub struct Model { #[sea_orm(unique)] pub commit_id: String, pub tree: String, - pub parents_id: Value, + pub parents_id: Json, #[sea_orm(column_type = "Text", nullable)] pub author: Option, #[sea_orm(column_type = "Text", nullable)] diff --git a/jupiter/callisto/src/mega_issue.rs b/jupiter/callisto/src/mega_issue.rs index 5132cb0e4..fd59ac0a9 100644 --- a/jupiter/callisto/src/mega_issue.rs +++ b/jupiter/callisto/src/mega_issue.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/mega_mr.rs b/jupiter/callisto/src/mega_mr.rs index f541b8ee2..419c807cd 100644 --- a/jupiter/callisto/src/mega_mr.rs +++ b/jupiter/callisto/src/mega_mr.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/mega_mr_comment.rs b/jupiter/callisto/src/mega_mr_comment.rs index 22b98c994..c63f714ff 100644 --- a/jupiter/callisto/src/mega_mr_comment.rs +++ b/jupiter/callisto/src/mega_mr_comment.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -8,7 +8,7 @@ pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: i64, pub conv_id: i64, - #[sea_orm(column_type = "Text")] + #[sea_orm(column_type = "Text", nullable)] pub comment: Option, pub edited: bool, } diff --git a/jupiter/callisto/src/mega_mr_conv.rs b/jupiter/callisto/src/mega_mr_conv.rs index a2474527e..ac1633cd7 100644 --- a/jupiter/callisto/src/mega_mr_conv.rs +++ b/jupiter/callisto/src/mega_mr_conv.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/mega_refs.rs b/jupiter/callisto/src/mega_refs.rs index 0849c5071..4476f3626 100644 --- a/jupiter/callisto/src/mega_refs.rs +++ b/jupiter/callisto/src/mega_refs.rs @@ -1,14 +1,13 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "mega_refs")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: i64, - #[sea_orm(column_type = "Text")] + #[sea_orm(column_type = "Text", unique)] pub path: String, pub ref_commit_hash: String, pub ref_tree_hash: String, diff --git a/jupiter/callisto/src/mega_tag.rs b/jupiter/callisto/src/mega_tag.rs index 2273e7a43..4052fe58c 100644 --- a/jupiter/callisto/src/mega_tag.rs +++ b/jupiter/callisto/src/mega_tag.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; diff --git a/jupiter/callisto/src/mega_tree.rs b/jupiter/callisto/src/mega_tree.rs index d633c783d..e0a48fa02 100644 --- a/jupiter/callisto/src/mega_tree.rs +++ b/jupiter/callisto/src/mega_tree.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -8,6 +8,7 @@ pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: i64, pub tree_id: String, + #[sea_orm(column_type = "VarBinary(StringLen::None)")] pub sub_trees: Vec, pub size: i32, pub commit_id: String, diff --git a/jupiter/callisto/src/prelude.rs b/jupiter/callisto/src/prelude.rs index 34927d06e..115efa574 100644 --- a/jupiter/callisto/src/prelude.rs +++ b/jupiter/callisto/src/prelude.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 pub use crate::git_blob::Entity as GitBlob; pub use crate::git_commit::Entity as GitCommit; @@ -7,9 +7,10 @@ pub use crate::git_pr::Entity as GitPr; pub use crate::git_repo::Entity as GitRepo; pub use crate::git_tag::Entity as GitTag; pub use crate::git_tree::Entity as GitTree; -pub use crate::import_refs::Entity as GitRefs; +pub use crate::import_refs::Entity as ImportRefs; pub use crate::lfs_locks::Entity as LfsLocks; pub use crate::lfs_objects::Entity as LfsObjects; +pub use crate::lfs_split_relations::Entity as LfsSplitRelations; pub use crate::mega_blob::Entity as MegaBlob; pub use crate::mega_commit::Entity as MegaCommit; pub use crate::mega_issue::Entity as MegaIssue; @@ -19,4 +20,6 @@ pub use crate::mega_mr_conv::Entity as MegaMrConv; pub use crate::mega_refs::Entity as MegaRefs; pub use crate::mega_tag::Entity as MegaTag; pub use crate::mega_tree::Entity as MegaTree; -pub use crate::raw_blob::Entity as RawObjects; +pub use crate::raw_blob::Entity as RawBlob; +pub use crate::ztm_node::Entity as ZtmNode; +pub use crate::ztm_repo_info::Entity as ZtmRepoInfo; diff --git a/jupiter/callisto/src/raw_blob.rs b/jupiter/callisto/src/raw_blob.rs index a3a623d31..ef70af769 100644 --- a/jupiter/callisto/src/raw_blob.rs +++ b/jupiter/callisto/src/raw_blob.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0 use sea_orm::entity::prelude::*; @@ -11,11 +11,11 @@ pub struct Model { pub id: i64, #[sea_orm(unique)] pub sha1: String, - #[sea_orm(column_type = "Text")] + #[sea_orm(column_type = "Text", nullable)] pub content: Option, pub file_type: Option, pub storage_type: StorageType, - #[sea_orm(column_type = "Binary(BlobSize::Blob(None))", nullable)] + #[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)] pub data: Option>, #[sea_orm(column_type = "Text", nullable)] pub local_path: Option, diff --git a/jupiter/src/storage/lfs_storage.rs b/jupiter/src/storage/lfs_storage.rs index 30ac480e3..0b2cf21ca 100644 --- a/jupiter/src/storage/lfs_storage.rs +++ b/jupiter/src/storage/lfs_storage.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use callisto::{lfs_locks, lfs_objects, lfs_split_relation}; use sea_orm::{ ColumnTrait, DatabaseConnection, EntityTrait, InsertResult, IntoActiveModel, QueryFilter, }; +use callisto::{lfs_locks, lfs_objects, lfs_split_relations}; use common::errors::MegaError; #[derive(Clone)] @@ -39,9 +39,9 @@ impl LfsStorage { pub async fn new_lfs_relation( &self, - relation: lfs_split_relation::Model, - ) -> Result, MegaError> { - lfs_split_relation::Entity::insert(relation.into_active_model()) + relation: lfs_split_relations::Model, + ) -> Result, MegaError> { + lfs_split_relations::Entity::insert(relation.into_active_model()) .exec(self.get_connection()) .await .map_err(|e| MegaError::with_message(e.to_string().as_str())) @@ -61,13 +61,13 @@ impl LfsStorage { pub async fn get_lfs_relations( &self, oid: String, - ) -> Result, MegaError> { + ) -> Result, MegaError> { let obj = self.get_lfs_object(oid.clone()).await?; if obj.is_none() { return Err(MegaError::with_message("Object not found")); } - let result = lfs_split_relation::Entity::find() - .filter(lfs_split_relation::Column::OriOid.eq(oid)) + let result = lfs_split_relations::Entity::find() + .filter(lfs_split_relations::Column::OriOid.eq(oid)) .all(self.get_connection()) .await .unwrap(); @@ -83,8 +83,8 @@ impl LfsStorage { &self, sub_oid: &String, ) -> Result, MegaError> { - let result = lfs_split_relation::Entity::find() - .filter(lfs_split_relation::Column::SubOid.eq(sub_oid)) + let result = lfs_split_relations::Entity::find() + .filter(lfs_split_relations::Column::SubOid.eq(sub_oid)) .all(self.get_connection()) .await .unwrap(); @@ -101,10 +101,10 @@ impl LfsStorage { pub async fn delete_lfs_relation( &self, - object: lfs_split_relation::Model, + object: lfs_split_relations::Model, ) -> Result<(), MegaError> { - let r: lfs_split_relation::ActiveModel = object.into(); - lfs_split_relation::Entity::delete(r) + let r: lfs_split_relations::ActiveModel = object.into(); + lfs_split_relations::Entity::delete(r) .exec(self.get_connection()) .await .unwrap(); diff --git a/mercury/src/internal/model/blob.rs b/mercury/src/internal/model/blob.rs index 97aea30d7..bcab76433 100644 --- a/mercury/src/internal/model/blob.rs +++ b/mercury/src/internal/model/blob.rs @@ -26,7 +26,7 @@ impl From<&Blob> for git_blob::Model { blob_id: value.id.to_plain_str(), size: 0, commit_id: String::new(), - name: String::new(), + name: None, created_at: chrono::Utc::now().naive_utc(), } }