refactor(tabs): add constraint to ensure that only one tab can be active

This commit is contained in:
Yann Amsellem
2025-01-14 17:51:57 +01:00
parent 91accda8d0
commit e45c2f0bc8
2 changed files with 2 additions and 2 deletions

View File

@@ -4,5 +4,5 @@ CREATE TABLE IF NOT EXISTS tabs (
contents TEXT NOT NULL,
query_id INTEGER,
tab_index INTEGER NOT NULL,
active BOOL NOT NULL DEFAULT FALSE
active BOOL DEFAULT FALSE UNIQUE
);

View File

@@ -36,7 +36,7 @@ VALUES ${Array.from({ length: rows.length }).fill('(?,?,?,?,?, ?)').join(',\n')}
r.contents,
r.query_id ?? null,
r.tab_index,
r.tab_index === activeIndex
r.tab_index === activeIndex || null
])
.flat()
);