Skip to main content

kellnr_entity/
session.rs

1//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.17
2
3use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "session")]
7pub struct Model {
8    #[sea_orm(primary_key)]
9    pub id: i64,
10    #[sea_orm(column_type = "Text", unique)]
11    pub token: String,
12    #[sea_orm(column_type = "Text")]
13    pub created: String,
14    pub user_fk: i64,
15}
16
17#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
18pub enum Relation {
19    #[sea_orm(
20        belongs_to = "super::user::Entity",
21        from = "Column::UserFk",
22        to = "super::user::Column::Id",
23        on_update = "NoAction",
24        on_delete = "Cascade"
25    )]
26    User,
27}
28
29impl Related<super::user::Entity> for Entity {
30    fn to() -> RelationDef {
31        Relation::User.def()
32    }
33}
34
35impl ActiveModelBehavior for ActiveModel {}