multi script beta

This commit is contained in:
2026-09-12 18:23:56 -04:00
parent 30e59c900c
commit 85bcb05a7d
16 changed files with 1053 additions and 516 deletions
+10 -2
View File
@@ -207,7 +207,11 @@ export function deleteVersion(versionId: number): void {
}
const beta = db()
.prepare(`SELECT id FROM betas WHERE script_version_id = ? AND state = 'running'`)
.prepare(
`SELECT b.id FROM betas b
JOIN beta_scripts bs ON bs.beta_id = b.id
WHERE bs.script_version_id = ? AND b.state = 'running' LIMIT 1`
)
.get(versionId) as { id: number } | undefined;
if (beta) throw new ScriptError(`beta ${beta.id} is still running against this version`, 'in-use-beta');
@@ -221,7 +225,11 @@ export function deleteScript(scriptId: number): void {
throw new ScriptError('un-set scope before deleting a script', 'has-scope');
}
const beta = db()
.prepare(`SELECT id FROM betas WHERE script_id = ? AND state = 'running'`)
.prepare(
`SELECT b.id FROM betas b
JOIN beta_scripts bs ON bs.beta_id = b.id
WHERE bs.script_id = ? AND b.state = 'running' LIMIT 1`
)
.get(scriptId) as { id: number } | undefined;
if (beta) throw new ScriptError(`beta ${beta.id} is still running against this script`, 'has-active-beta');
db().prepare('DELETE FROM scripts WHERE id = ?').run(scriptId);