//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8 use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "samey_post")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub uploader_id: i32, pub media: String, pub width: i32, pub height: i32, #[sea_orm(column_type = "custom(\"enum_text\")")] pub media_type: String, pub thumbnail: String, pub thumbnail_width: i32, pub thumbnail_height: i32, pub title: Option, #[sea_orm(column_type = "Text", nullable)] pub description: Option, pub is_public: bool, #[sea_orm(column_type = "custom(\"enum_text\")")] pub rating: String, pub uploaded_at: DateTime, pub parent_id: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::samey_pool_post::Entity")] SameyPoolPost, #[sea_orm( belongs_to = "Entity", from = "Column::ParentId", to = "Column::Id", on_update = "NoAction", on_delete = "SetNull" )] SelfRef, #[sea_orm(has_many = "super::samey_post_source::Entity")] SameyPostSource, #[sea_orm(has_many = "super::samey_tag_post::Entity")] SameyTagPost, #[sea_orm( belongs_to = "super::samey_user::Entity", from = "Column::UploaderId", to = "super::samey_user::Column::Id", on_update = "NoAction", on_delete = "Cascade" )] SameyUser, } impl Related for Entity { fn to() -> RelationDef { Relation::SameyPoolPost.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::SameyPostSource.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::SameyTagPost.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::SameyUser.def() } } impl ActiveModelBehavior for ActiveModel {}