From bdf71fa0b7904028d084b9b66639fc2c2c9a312a Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Mon, 7 Sep 2026 10:59:55 +0300 Subject: [PATCH] Small history table change --- sql/history.sql | 2 +- src/app.rs | 3 ++- src/data_provider/history.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sql/history.sql b/sql/history.sql index e84074d..8fb9af8 100644 --- a/sql/history.sql +++ b/sql/history.sql @@ -2,7 +2,7 @@ create table history ( id INTEGER primary key autoincrement, - set_id INTEGER not null references decks on delete cascade, + deck_id INTEGER not null references decks on delete cascade, word_id INTEGER not null references words on delete cascade, timestamp INTEGER not null, answer INTEGER not null, diff --git a/src/app.rs b/src/app.rs index 7926ff8..02e2293 100644 --- a/src/app.rs +++ b/src/app.rs @@ -98,10 +98,11 @@ pub fn fill_state(state: &mut AppState) { let connection = state.connection.lock(); let setting = load_settings(&connection); - + drop(connection); state.word_groups.write().start().unwrap(); state.dictionary.write().start().unwrap(); state.decks.write().start().unwrap(); + state.history.write().start().unwrap(); state.sync_data = Arc::new(RwLock::new(setting)) } diff --git a/src/data_provider/history.rs b/src/data_provider/history.rs index 00aee94..2d64d68 100644 --- a/src/data_provider/history.rs +++ b/src/data_provider/history.rs @@ -13,7 +13,7 @@ pub type HistoryDataLayer = SqliteDbLayer; pub struct HistoryQuerySet; impl TableAccessQuerySet for HistoryQuerySet { fn load() -> &'static str { - "SELECT rowid, set_id, state_id, timestamp, answer, before, after, fsrs FROM history" + "SELECT rowid, deck_id, word_id, timestamp, answer, before, after, fsrs FROM history" } fn save() -> &'static str { @@ -21,7 +21,7 @@ impl TableAccessQuerySet for HistoryQuerySet { } fn add() -> &'static str { - "INSERT INTO history (set_id, state_id, timestamp, answer, before, after, fsrs) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)" + "INSERT INTO history (deck_id, state_id, timestamp, answer, before, after, fsrs) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)" } fn name() -> &'static str {