use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "bills")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub self_id: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")] SelfRef, } impl ActiveModelBehavior for ActiveModel {}