feat(mixtape): schema migrations for collections and items
Two new tables (mixtape_collections, mixtape_collection_items) with CASCADE on delete and indexes for the two common query patterns. One additive column on session_queue_state for queue-source tracking. Idempotent (CREATE TABLE IF NOT EXISTS, ALTER only when missing), safe on every app start. The ALTER is skipped gracefully if session_queue_state hasn't been created yet. Adds LibraryDatabase::with_connection() helper (qbz-library) so src-tauri can run external DDL on the shared Connection without exposing it as a field. Migration is wired in session_lifecycle immediately after library.init_at() in both the online and offline activation paths. cc
This commit is contained in:
7 files changed
+185
No files matched your search
@@ -741,6 +741,19 @@ impl LibraryDatabase {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Provide raw connection access for external schema migrations.
|
||||
///
|
||||
/// This is intentionally narrow: callers receive a shared reference so
|
||||
/// they can run DDL (CREATE TABLE, ALTER TABLE) but cannot move the
|
||||
/// connection out or replace it. Use sparingly — prefer adding methods
|
||||
/// to LibraryDatabase directly for DML queries.
|
||||
pub fn with_connection<F, R>(&self, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&Connection) -> R,
|
||||
{
|
||||
f(&self.conn)
|
||||
}
|
||||
|
||||
// === Folder Management ===
|
||||
|
||||
/// Add a folder to the library with optional network info
|
||||
|
||||
Reference in new issue
Block a user