diff options
| author | tv <tv@krebsco.de> | 2026-11-29 15:02:23 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-30 14:59:15 +0000 |
| commit | a0f22c88d54d351b060c2d0d9f0a8cbf5f412ba2 (patch) | |
| tree | d65495f9ed222fb978bc09afcb3bd644a99aa7c5 /src/schema.rs | |
| parent | 83f1d36bbaeb193ae1c663b5b1b7956661ecac8c (diff) | |
enstate: --migrate, renames both ways, kept entries
What a generation sees of a snapshot accepted under another schema:
same name and type, renamedFrom, a rename in the stored schema read
backwards, and entries kept, with their types, in the snapshot's kept/.
Plans start from what is seen, and store it under the running schema;
a generation change rewrites no snapshot. --migrate (and --dry-run)
says what each channel sees, refuses for required slots nothing fills,
puts the views in place and runs their reactions; --materialize and
--status go by what is seen, too. A view made from an unfilled
required slot isn't there. The rollback cases of migrations.md that
need no converters or steps are tests.
Diffstat (limited to 'src/schema.rs')
| -rw-r--r-- | src/schema.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/schema.rs b/src/schema.rs index a44f6f8..8b20777 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -66,6 +66,9 @@ pub struct SlotSpec { pub required: bool, #[serde(default)] pub secret: bool, + /// The name the slot had in an earlier schema (docs/design.md, section 6). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub renamed_from: Option<String>, } fn yes() -> bool { @@ -123,6 +126,10 @@ impl Schema { name::check("channel", channel)?; for (slot, spec) in &mut spec.slots { name::check("slot", slot)?; + if let Some(old) = &spec.renamed_from { + name::check("slot", old) + .with_context(|| format!("slot {channel}/{slot}: renamedFrom"))?; + } spec.media_type = media::normalize(&spec.media_type) .with_context(|| format!("slot {channel}/{slot}"))?; } |
