Add history table and modify card_stats

This commit is contained in:
micialware committed 2026-08-28 17:44:14 +03:00
1 parent 1f3ad22e05
commit 663fa377b1
6 files changed
+153 -5

No files matched your search

+7
View File
@@ -20,6 +20,7 @@ fn create_tables(conn: &Connection) {
make_word_group(conn).expect("Failed to init table");
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");
}
fn make_settings(conn: &Connection) -> Result<(), rusqlite::Error> {
@@ -51,6 +52,12 @@ fn make_card_stats(conn: &Connection) -> Result<(), rusqlite::Error> {
Ok(())
}
fn make_history(conn: &Connection) -> Result<(), rusqlite::Error> {
let query = include_str!("../../sql/history.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");