//! The tables whose edits earn a version, and the kind each records. //! //! This was `packages/store/src/schema/versions.ts`. Step 5i deleted that //! package, and R18's rule is that a declaration other guards derive from //! MOVES in the same change rather than dying in it. `cotton-core`'s history //! tests read this list and cross-check it against the trigger SQL in //! [`crate::schema::ddl`] — which is the only other place `redact` and `omit` //! are written down, and there they are SQL rather than a list anyone can read. //! //! Two fields of the TypeScript declaration are deliberately NOT carried. //! `skip` named the columns a version trigger ignores and `since` the //! migration that creates the table; both were inputs to the TypeScript //! migrator, and Rust's ladder is a single step that issues the whole schema. //! Neither has a reader here, and an unread field is a field free to drift. /// One versioned table. pub struct VersionedTable { /// The table the trigger fires on. pub table: &'static str, /// The `record_kind` its version rows carry. pub kind: &'static str, /// Columns the trigger replaces with `has_` — the secret never /// reaches the snapshot. pub redact: &'static [&'static str], /// Columns the trigger leaves out of the snapshot entirely. pub omit: &'static [&'static str], } /// Every table that earns history, in the order it was declared. /// /// The order is part of the declaration: `cotton-core`'s reader self-test pins /// the count, and a diff that reorders this list reads as a change to it. pub static VERSIONED_TABLES: &[VersionedTable] = &[ VersionedTable { table: "cotton_todos", kind: "todo", redact: &[], omit: &[] }, VersionedTable { table: "cotton_events", kind: "event", redact: &[], omit: &[] }, VersionedTable { table: "cotton_notes", kind: "note", redact: &[], omit: &[] }, VersionedTable { table: "cotton_people", kind: "person", redact: &[], omit: &[] }, VersionedTable { table: "cotton_locations", kind: "location", redact: &[], omit: &[] }, VersionedTable { table: "cotton_alarms", kind: "alarm", redact: &[], omit: &[] }, VersionedTable { table: "cotton_pages", kind: "page", redact: &[], omit: &[] }, VersionedTable { table: "cotton_todo_recurrences", kind: "todo_recurrence", redact: &[], omit: &[] }, VersionedTable { table: "cotton_meetings", kind: "meeting", redact: &[], omit: &[] }, // The one entry with anything to redact: a document's password is replaced // by `has_password` on its way into the snapshot, so the history a person // browses can say a password was set without ever carrying one. VersionedTable { table: "cotton_documents", kind: "document", redact: &["password"], omit: &[] }, VersionedTable { table: "cotton_goals", kind: "goal", redact: &[], omit: &[] }, VersionedTable { table: "cotton_memories", kind: "memory", redact: &[], omit: &[] }, VersionedTable { table: "cotton_screenplay_scenes", kind: "screenplay_scene", redact: &[], omit: &[] }, VersionedTable { table: "cotton_screenplay_documents", kind: "screenplay_document", redact: &[], omit: &[] }, VersionedTable { table: "cotton_money_transactions", kind: "transaction", redact: &[], omit: &[] }, VersionedTable { table: "cotton_decisions", kind: "decision", redact: &[], omit: &[] }, // Explicit send transitions need a receipt; bulk ingestion opts out with History::None. VersionedTable { table: "cotton_msg_messages", kind: "message", redact: &[], omit: &[] }, // gen-kind: versioned-tables ];