fix(database): make playback session migration idempotent

This commit is contained in:
zarzet
2026-08-01 17:39:45 +07:00
parent 611f7377f6
commit 19753ca005
2 changed files with 24 additions and 1 deletions
+4 -1
View File
@@ -103,8 +103,11 @@ class AppStateDatabase {
}
static Future<void> _createPlaybackSessionTable(Database db) {
// Keep this idempotent so an interrupted migration or a database restored
// from an intermediate build can resume v1 -> v2 without losing queue
// state merely because the table was already created.
return db.execute('''
CREATE TABLE $_playbackSessionTable (
CREATE TABLE IF NOT EXISTS $_playbackSessionTable (
id INTEGER PRIMARY KEY CHECK (id = 1),
session_json TEXT NOT NULL,
updated_at TEXT NOT NULL