You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P0/arch] Query history belongs in SQLite, not localStorage #585
src/stores/historyStore.ts persists the whole entry array to localStorage under mas-query-history via zustand/middleware::persist.
Problem
localStorage is the wrong medium for an append-only log that grows with use:
Shared quota. 5–10 MB per origin, shared with sqlpilot-query-settings, sqlpilot-formatter-settings and mas-query-favorites. A large history can push the others out.
Silent loss.persist swallows a quota failure. History stops recording and nothing says so.
Unbounded entries. One pasted migration script is stored whole and can consume the quota by itself.
Every comparable client (DBeaver, DataGrip, MySQL Workbench) keeps history in a file or embedded database.
Precedent in this repo
ConnectionStore (src-tauri/crates/mas-core/src/connection/store.rs) is already SQLite with a migrations module. ARCHITECTURE §9.4 notes a query_history table from earlier drafts that was never implemented.
Expected
History in a local SQLite database. Writes are async and do not block the UI thread. Entry SQL is capped at a sane size with a marker when truncated. A migration imports whatever is in localStorage on first run, then clears the key.
Notes
Supersedes #331 — debouncing is a workaround for the medium, not a fix.
Acceptance
History survives clearing browser site data; adding an entry does not serialise the full history; a 10 MB statement does not consume the store; existing localStorage history is imported once.
Activity
feat(history): move query history into SQLite
feat(history): move query history into SQLite
fix(startup): stop panicking before the window exists (#666)