pub fn ensure_unique_pk_index_for(
conn: &Connection,
table: &str,
column_names: &[&str],
primary_key: &[usize],
pk_is_rowid_alias: bool,
without_rowid: bool,
) -> Result<(), ReplicaError>Expand description
Ensure table has a UNIQUE index covering exactly the PK columns, which row-identity
point lookups (the engine’s TableSource, the follower’s apply keys) require.
Idempotent. column_names is the table’s columns in cid order; primary_key holds
indexes into it.
A rowid-alias INTEGER PRIMARY KEY is skipped: the rowid already enforces uniqueness and
SQLite point-looks-it-up natively (SEARCH … USING INTEGER PRIMARY KEY (rowid=?)), so a
synthetic index would be pure write amplification with no plan benefit. (Databases created by
older versions may still carry a now-unused rindle_replica_pk_* index; it is harmless and
left in place.)