Skip to main content

safe_migrate/model/
sequence.rs

1// FILE: ./src/model/sequence.rs
2
3use crate::ast::identifiers::ObjectId;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub enum SequenceKind {
8    Standalone,
9    Owned,
10    SerialLike,
11    Identity,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15pub struct SequenceState {
16    pub id: ObjectId,
17    pub owner: ObjectId,
18    pub owned_by: Option<(ObjectId, String)>,
19    pub kind: SequenceKind,
20    pub generation: u64,
21}
22
23// This mirrors the unboxed relation/type overlay API. SequenceState is larger
24// because V5 keeps ownership identities inline, while boxing every hot-path
25// lookup would add allocation and widespread indirection.
26#[allow(clippy::large_enum_variant)]
27#[derive(Debug, Clone, PartialEq)]
28pub enum SequenceOverlay {
29    Present(SequenceState),
30    Dropped,
31}