Custom fields table
This commit is contained in:
1 parent
ba834ac9b1
commit
6d363c8148
2 files changed
+11
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
create table custom_fields(
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
name TEXT not null
|
||||||
|
);
|
||||||
@@ -21,6 +21,7 @@ fn create_tables(conn: &Connection) {
|
|||||||
make_words(conn).expect("Failed to init table");
|
make_words(conn).expect("Failed to init table");
|
||||||
make_card_stats(conn).expect("Failed to init table");
|
make_card_stats(conn).expect("Failed to init table");
|
||||||
make_history(conn).expect("Failed to init table");
|
make_history(conn).expect("Failed to init table");
|
||||||
|
make_custom_fields(conn).expect("Failed to init table");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_settings(conn: &Connection) -> Result<(), rusqlite::Error> {
|
fn make_settings(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||||
@@ -58,6 +59,12 @@ fn make_history(conn: &Connection) -> Result<(), rusqlite::Error> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_custom_fields(conn: &Connection) -> Result<(), rusqlite::Error> {
|
||||||
|
let query = include_str!("../../sql/custom_fields.sql");
|
||||||
|
conn.execute(query, ())?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn default_connection() -> Connection {
|
pub fn default_connection() -> Connection {
|
||||||
let db_file = db_path();
|
let db_file = db_path();
|
||||||
let connection = Connection::open(db_file).expect("Failed to open database");
|
let connection = Connection::open(db_file).expect("Failed to open database");
|
||||||
|
|||||||
Reference in new issue
Block a user