refactor(tabs): add constraint to ensure that only one tab can be active
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user