Custom fields table

This commit is contained in:
micialware committed 2026-08-31 11:23:41 +03:00
1 parent ba834ac9b1
commit 6d363c8148
2 files changed
+11

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
create table custom_fields(
id INTEGER PRIMARY KEY,
name TEXT not null
);
+7
View File
@@ -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");