use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "pull_request")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(unique_key = "repo_number")] pub repo_id: Uuid, pub issue_id: Uuid, #[sea_orm(unique_key = "repo_number")] pub autoincrement_id: i32, pub author_id: Uuid, pub title: String, pub body: String, pub head_branch: String, pub head_sha: String, pub base_branch: String, pub base_sha: String, pub has_merged: bool, pub merged_commit_sha: Option, pub additions: i32, pub deletions: i32, pub files_changed: i32, pub merger_id: Option, pub merged_at: Option, pub is_locked: bool, pub created_at: OffsetDateTime, pub updated_at: Option, pub closed_at: Option, #[sea_orm(belongs_to, from = "repo_id", to = "id")] pub repo: BelongsTo, #[sea_orm(belongs_to, from = "issue_id", to = "id")] pub issue: BelongsTo, #[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")] pub author: BelongsTo, #[sea_orm(belongs_to, relation_enum = "Merger", from = "merger_id", to = "uid")] pub merger: BelongsTo>, } impl ActiveModelBehavior for ActiveModel {}