Skip to main content

init_schema

Function init_schema 

Source
pub fn init_schema(conn: &Connection) -> Result<(), Error>
Expand description

Create the __kv table if it is not there yet.

register / register_with run this on the supplied connection before exposing std.kv, so hosts do not have to. It is public for hosts that prefer to own schema setup themselves — right after opening the connection, before it is wrapped in Arc<Mutex<_>>:

let conn = Connection::open(kv_path)?;
mlua_batteries_sqlite::kv::init_schema(&conn)?;

The DDL is CREATE TABLE IF NOT EXISTS, so running it twice is harmless.