buffer_snapshot.rs

 1use crate::db::BufferId;
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "buffer_snapshots")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub buffer_id: BufferId,
 9    #[sea_orm(primary_key)]
10    pub epoch: i32,
11    pub text: String,
12    pub operation_serialization_version: i32,
13}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17    #[sea_orm(
18        belongs_to = "super::buffer::Entity",
19        from = "Column::BufferId",
20        to = "super::buffer::Column::Id"
21    )]
22    Buffer,
23}
24
25impl Related<super::buffer::Entity> for Entity {
26    fn to() -> RelationDef {
27        Relation::Buffer.def()
28    }
29}
30
31impl ActiveModelBehavior for ActiveModel {}