Start work on storing channel buffers
This commit is contained in:
parent
29e43384f0
commit
ff5035ea37
16 changed files with 484 additions and 4 deletions
32
crates/collab/src/db/tables/buffer.rs
Normal file
32
crates/collab/src/db/tables/buffer.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
use crate::db::BufferId;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "buffers")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: BufferId,
|
||||
pub epoch: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::buffer_operation::Entity")]
|
||||
Operations,
|
||||
#[sea_orm(has_many = "super::buffer_snapshot::Entity")]
|
||||
Snapshots,
|
||||
}
|
||||
|
||||
impl Related<super::buffer_operation::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Operations.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::buffer_snapshot::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Snapshots.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
Loading…
Add table
Add a link
Reference in a new issue