58 lines
1.6 KiB
Rust
58 lines
1.6 KiB
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.11
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "github_repository_syncs")]
|
|
pub struct Model {
|
|
pub created_at: DateTimeWithTimeZone,
|
|
pub updated_at: DateTimeWithTimeZone,
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
#[sea_orm(column_type = "JsonBinary")]
|
|
pub credentials: Json,
|
|
pub actor_id: Uuid,
|
|
pub created_by_id: Option<Uuid>,
|
|
pub label_id: Option<Uuid>,
|
|
pub project_id: Uuid,
|
|
pub repository_id: Uuid,
|
|
pub updated_by_id: Option<Uuid>,
|
|
pub workspace_id: Uuid,
|
|
pub workspace_integration_id: Uuid,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::projects::Entity",
|
|
from = "Column::ProjectId",
|
|
to = "super::projects::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Projects,
|
|
#[sea_orm(
|
|
belongs_to = "super::workspaces::Entity",
|
|
from = "Column::WorkspaceId",
|
|
to = "super::workspaces::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Workspaces,
|
|
}
|
|
|
|
impl Related<super::projects::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Projects.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::workspaces::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Workspaces.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|