Fix retention query performance and cleanup scheduling
This commit is contained in:
@@ -353,6 +353,8 @@ export function db(): Database.Database {
|
||||
migrateTable(handle, 'beta_test_runs', [{ name: 'revision', ddl: 'ALTER TABLE beta_test_runs ADD COLUMN revision INTEGER NOT NULL DEFAULT 1' }]);
|
||||
migrateTable(handle, 'deployment_scripts', DEPLOYMENT_SCRIPTS_COLUMNS);
|
||||
migrateTable(handle, 'deployments', DEPLOYMENTS_COLUMNS);
|
||||
// Older databases gain rolled_back_by above, after schema.sql runs.
|
||||
handle.exec('CREATE INDEX IF NOT EXISTS idx_deployments_rolled_back_by ON deployments(rolled_back_by)');
|
||||
migrateTable(handle, 'server_launch_collections', [
|
||||
{ name: 'mode', ddl: "ALTER TABLE server_launch_collections ADD COLUMN mode TEXT NOT NULL DEFAULT 'fill'" },
|
||||
{ name: 'retained_servers', ddl: "ALTER TABLE server_launch_collections ADD COLUMN retained_servers TEXT NOT NULL DEFAULT '[]'" }
|
||||
|
||||
@@ -522,6 +522,7 @@ CREATE TABLE IF NOT EXISTS provisioning_sources (
|
||||
server TEXT NOT NULL,
|
||||
PRIMARY KEY (operation_id, kind, source_id, server)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_provisioning_sources_source ON provisioning_sources(kind, source_id);
|
||||
|
||||
-- Blueprints retain map/count selections only. The legacy column name remains
|
||||
-- compatible with older snapshot-based definitions, read as selections at runtime.
|
||||
@@ -732,6 +733,7 @@ CREATE TABLE IF NOT EXISTS watchdog_actions (
|
||||
cycle INTEGER NOT NULL DEFAULT 1,
|
||||
UNIQUE(incident_id,cycle,action)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_watchdog_actions_campaign ON watchdog_actions(campaign_id);
|
||||
|
||||
-- Explicit history holds and failure resolution never bypass dependency checks.
|
||||
CREATE TABLE IF NOT EXISTS retention_controls (
|
||||
|
||||
Reference in New Issue
Block a user