fix: graphics settings store fails on existing databases

The CREATE TABLE included force_x11 column but INSERT OR IGNORE
also referenced it, so on existing DBs (without the column) the
entire execute_batch failed before reaching the ALTER TABLE
migration. Keep original schema in CREATE/INSERT, let ALTER add
the new column.
This commit is contained in:
vicrodh committed 2026-02-10 08:37:35 -06:00
1 parent d6e9375333
commit 63abf1f90c
1 file changed
+3 -4
+3 -4
View File
@@ -49,13 +49,12 @@ impl GraphicsSettingsStore {
conn.execute_batch(
"CREATE TABLE IF NOT EXISTS graphics_settings (
id INTEGER PRIMARY KEY CHECK (id = 1),
hardware_acceleration INTEGER NOT NULL DEFAULT 0,
force_x11 INTEGER NOT NULL DEFAULT 0
hardware_acceleration INTEGER NOT NULL DEFAULT 0
);
INSERT OR IGNORE INTO graphics_settings (id, hardware_acceleration, force_x11) VALUES (1, 0, 0);"
INSERT OR IGNORE INTO graphics_settings (id, hardware_acceleration) VALUES (1, 0);"
).map_err(|e| format!("Failed to create graphics settings table: {}", e))?;
// Migration: add force_x11 column for existing databases
// Migration: add force_x11 column (no-op if already present)
let _ = conn.execute_batch(
"ALTER TABLE graphics_settings ADD COLUMN force_x11 INTEGER NOT NULL DEFAULT 0;"
);