librmo/entity/
music.rs

1//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15
2
3use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "music")]
7pub struct Model {
8    #[sea_orm(primary_key)]
9    pub id: i32,
10    pub media_id: i32,
11    pub mtime: String,
12    pub processed_mtime: String,
13}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17    #[sea_orm(
18        belongs_to = "super::media::Entity",
19        from = "Column::MediaId",
20        to = "super::media::Column::Id",
21        on_update = "NoAction",
22        on_delete = "Cascade"
23    )]
24    Media,
25    #[sea_orm(has_many = "super::report::Entity")]
26    Report,
27    #[sea_orm(has_many = "super::track::Entity")]
28    Track,
29}
30
31impl Related<super::media::Entity> for Entity {
32    fn to() -> RelationDef {
33        Relation::Media.def()
34    }
35}
36
37impl Related<super::report::Entity> for Entity {
38    fn to() -> RelationDef {
39        Relation::Report.def()
40    }
41}
42
43impl Related<super::track::Entity> for Entity {
44    fn to() -> RelationDef {
45        Relation::Track.def()
46    }
47}
48
49impl ActiveModelBehavior for ActiveModel {}