Rindle docs and package mapSkip to main content

transactionally_apply_schema

Function transactionally_apply_schema 

pub fn transactionally_apply_schema(
    conn: &Connection,
    cdc: &CaptureCtx,
    op: &'static str,
    protect_registered_tables: bool,
    allow_row_changes: bool,
    apply: impl FnOnce() -> Result<(), ReplicaError>,
) -> Result<(), ReplicaError>
Expand description

Run an already-preflighted schema operation and prove its post-state before commit.

The writer’s preupdate hook remains installed outside ordinary write transactions. Use it here as a second line of defense against any table-row changes SQLite reports for a schema operation; ordinary schema catalog and ANALYZE bookkeeping are in SQLite/Rindle internal tables and intentionally excluded by the capture context. SQLite does not report CTAS row creation to the hook, but CTAS cannot declare the primary key required by the complete public schema envelope, so validation still rejects it before commit. A successful operation therefore changes schema only and leaves that schema inside the replication envelope.