shipd_core/db/mod.rs
1pub mod projects;
2mod schema;
3pub mod tasks;
4
5use rusqlite::Connection;
6use schema::*;
7
8pub fn initialize(path: &str) -> Result<Connection, rusqlite::Error> {
9 let conn = Connection::open(path)?;
10
11 conn.execute_batch(&format!(
12 "{CREATE_PROJECTS_TABLE};
13 {CREATE_TASKS_TABLE};
14 {CREATE_TAGS_TABLE};
15 {CREATE_TASK_TAGS_TABLE};
16 "
17 ))?;
18
19 Ok(conn)
20}