Skip to main content

safe_migrate/model/
sequence.rs

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