#[allow(dead_code)]
pub const STORE_TABLES: &[(&str, &str)] = &[
(
"todos",
"create table if not exists todos (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"knowledge",
"create table if not exists knowledge (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"governance",
"create table if not exists governance (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"memory",
"create table if not exists memory (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"automation",
"create table if not exists automation (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"broker_dedupe",
"create table if not exists broker_dedupe (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"lcm",
"create table if not exists lcm (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"federation",
"create table if not exists federation (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
(
"events",
"create table if not exists events (
id integer primary key,
title text not null,
status text not null,
assignee text
)",
),
];
#[allow(dead_code)]
pub const STORE_NAMES: &[&str] = &[
"todos",
"knowledge",
"governance",
"memory",
"automation",
"broker_dedupe",
"lcm",
"federation",
"events",
];
#[allow(dead_code)]
pub fn bootstrap(conn: &rusqlite::Connection) -> rusqlite::Result<()> {
for (_name, ddl) in STORE_TABLES {
conn.execute(ddl, [])?;
}
Ok(())
}
#[allow(dead_code)]
pub fn bootstrap_table(conn: &rusqlite::Connection, name: &str) -> rusqlite::Result<()> {
if let Some((_, ddl)) = STORE_TABLES.iter().find(|(n, _)| *n == name) {
conn.execute(ddl, [])?;
}
Ok(())
}