Skip to main content

ensure_projection

Function ensure_projection 

Source
pub fn ensure_projection(bones_dir: &Path) -> Result<Option<Connection>>
Expand description

Ensure the projection database exists and is up-to-date.

If the database is missing, corrupt, or behind the event log, an incremental apply is triggered automatically. Returns None only if the events directory itself does not exist (no bones project).

This is the recommended entry point for read commands — it eliminates the need for users to run bn admin rebuild manually.

§Arguments

  • bones_dir — Path to the .bones/ directory.

§Errors

Returns an error if the rebuild or database open fails.