use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "account_transactions")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub hash: Vec<u8>,
#[sea_orm(primary_key, auto_increment = false)]
pub signature: Vec<u8>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::accounts::Entity",
from = "Column::Hash",
to = "super::accounts::Column::Hash",
on_update = "NoAction",
on_delete = "Cascade"
)]
Accounts,
#[sea_orm(
belongs_to = "super::transactions::Entity",
from = "Column::Signature",
to = "super::transactions::Column::Signature",
on_update = "NoAction",
on_delete = "Cascade"
)]
Transactions,
}
impl Related<super::accounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Accounts.def()
}
}
impl Related<super::transactions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Transactions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}