Skip to main content

crosup_entity/
file.rs

1use sea_orm::entity::prelude::*;
2use sea_orm::DeriveEntityModel;
3
4#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
5#[sea_orm(table_name = "file")]
6pub struct Model {
7    #[sea_orm(primary_key)]
8    pub id: i32,
9    pub name: String,
10    pub path: String,
11    #[sea_orm(column_type = "Timestamp")]
12    pub created_at: chrono::NaiveDateTime,
13}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17    #[sea_orm(has_many = "super::modification::Entity")]
18    Modification,
19}
20
21// `Related` trait has to be implemented by hand
22impl Related<super::modification::Entity> for Entity {
23    fn to() -> RelationDef {
24        Relation::Modification.def()
25    }
26}
27
28impl ActiveModelBehavior for ActiveModel {}