Skip to main content

init_tables

Function init_tables 

Source
pub async fn init_tables(db: &Db) -> Result<()>
Expand description

Initialise every auth-related table. Safe to call on every boot.

Fast-path: the full sequence below is idempotent but costs ~13 DDL round-trips. We stamp the crate version into rustio_admin_meta once it has run, and skip the sequence when the stored stamp already matches the running version. A fresh database (no stamp) or a framework upgrade (version changed) runs the full sequence and re-stamps, so any schema change shipped in a new release self-heals on the first boot of that release. To force a re-run on the same version, TRUNCATE rustio_admin_meta.