use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "git_branch")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(unique_key = "repo_name")] pub repo_id: Uuid, #[sea_orm(unique_key = "repo_name")] pub name: String, pub commit_sha: String, pub is_deleted: bool, // 由 repo_branch_protection_policy 是否有匹配策略派生,写策略时必须同步该缓存标志 pub is_protected: bool, pub deleted_at: Option, pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, #[sea_orm(belongs_to, from = "repo_id", to = "id")] pub repo: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}