diff --git a/sql/custom_fields.sql b/sql/custom_fields.sql new file mode 100644 index 0000000..f965f15 --- /dev/null +++ b/sql/custom_fields.sql @@ -0,0 +1,4 @@ +create table custom_fields( + id INTEGER PRIMARY KEY, + name TEXT not null +); \ No newline at end of file diff --git a/src/data_provider/sqlite.rs b/src/data_provider/sqlite.rs index 800f70f..85821a7 100644 --- a/src/data_provider/sqlite.rs +++ b/src/data_provider/sqlite.rs @@ -21,6 +21,7 @@ fn create_tables(conn: &Connection) { make_words(conn).expect("Failed to init table"); make_card_stats(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> { @@ -58,6 +59,12 @@ fn make_history(conn: &Connection) -> Result<(), rusqlite::Error> { 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 { let db_file = db_path(); let connection = Connection::open(db_file).expect("Failed to open database");