Use ordered SQLite migrations (Refs #75)
CI / checks (push) Successful in 5m6s

This commit is contained in:
2026-10-10 00:01:18 -04:00
parent a0663e43b8
commit 8d1bb69591
56 changed files with 1085 additions and 736 deletions
@@ -1,6 +1,5 @@
import { pauseScalingForOperation } from '../autoscaling/ownership.js';
import { db } from '../db/index.js';
import { ensureHostSchema } from '../hosts/schema.js';
import { recordProgress } from './progress.js';
import { requestRebalanceStopForOperation } from '../rebalancing/admission.js';
@@ -42,7 +41,6 @@ export function cancelProvisioningJob(
reason = 'Cancelled by operator',
options: { preserveRebalanceRun?: boolean } = {}
): boolean {
ensureHostSchema(db());
return db().transaction(() => {
if (provisioningCancelled(id)) return true;
if (!canCancelProvisioningJob(id)) return false;
@@ -1,4 +1,3 @@
import { ensureHostSchema } from '../hosts/schema.js';
import { db } from '../db/index.js';
import { fleetSettings } from '../settings.js';
@@ -16,7 +15,6 @@ interface Holder {
}
export function lifecycleHolders(): Holder[] {
ensureHostSchema(db());
// Find capacity owners through their active state or outstanding command.
// A correlated OR over d used to walk every retained job and fetch its agent
// receipt on every admission, even when all that history was completed.
-3
View File
@@ -23,7 +23,6 @@ import {
} from './cancellation.js';
import { committedRebalanceStartup } from './concurrency.js';
import { nativeDeployment } from '../backends/native.js';
import { ensureHostSchema } from '../hosts/schema.js';
import { safetyOverride, safetyOverrideAvailability } from './safety-override.js';
import { serverTitle } from '../../ui/server-labels.js';
import { provisioningQueueStatus } from '../../ui/provisioning-queue.js';
@@ -420,7 +419,6 @@ export function resumeCleanup(id: string): boolean {
}
export function canResumeVerification(id: string): boolean {
ensureHostSchema(db());
return !!db()
.prepare(
`SELECT d.id FROM server_deployments d
@@ -444,7 +442,6 @@ export function canResumeVerification(id: string): boolean {
/** A conclusively failed initial create can enter the normal rebuild flow. */
export function canRetryWithRebuild(id: string): boolean {
ensureHostSchema(db());
return !!db()
.prepare(
`SELECT d.id FROM server_deployments d
-2
View File
@@ -14,7 +14,6 @@ import { choosePlacement, availableHostPort, type PlacementOptions } from '../ho
import { randomBytes, randomUUID } from 'node:crypto';
import { posix } from 'node:path';
import { db } from '../db/index.js';
import { ensureHostSchema } from '../hosts/schema.js';
import { unsettledCancelledCommand } from './cancellation.js';
import { config, relDestForKind, serverDir } from '../config.js';
import {
@@ -1014,7 +1013,6 @@ export async function processNativeProvisioning(
}) => string | null,
options: { wait?: boolean } = {}
): Promise<void> {
ensureHostSchema(db());
const cancelled = db()
.prepare(
`SELECT d.id FROM server_deployments d