mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix(state): migrate exact v14 session schema (#126354)
This commit is contained in:
@@ -42,6 +42,7 @@ function removeSchemaRange(sql: string, startMarker: string, endMarker: string):
|
||||
export function historicalV15AgentSchemaSql(): string {
|
||||
let sql = restoreHistoricalAgentLeaseSchema(OPENCLAW_AGENT_SCHEMA_SQL)
|
||||
.replace(" entry_valid INTEGER NOT NULL DEFAULT 0 CHECK (entry_valid IN (-1, 0, 1)),\n", "")
|
||||
.replace(" project_id TEXT,\n", "")
|
||||
.replace(
|
||||
" owner_actor_type TEXT,\n owner_actor_id TEXT,\n owner_assigned_by_type TEXT,\n owner_assigned_by_id TEXT,\n owner_assigned_at INTEGER,\n",
|
||||
"",
|
||||
|
||||
@@ -26,8 +26,9 @@ describe("legacy media persistence Doctor migration from historical v14", () =>
|
||||
it("migrates a copy of the exact v2026.7.2-beta.4 schema without losing its session", () => {
|
||||
const historicalSchema = historicalV14AgentSchemaSql();
|
||||
expect(createHash("sha256").update(historicalSchema).digest("hex")).toBe(
|
||||
"dfb2a98c9418eb1032e82e4310c7bde41700e4a0af05a2464673e9c4ece11fd1",
|
||||
"955889668707fbccab70b80b5058af5a1587fd35ae32a80f8605179a68fb5117",
|
||||
);
|
||||
expect(historicalSchema).not.toContain(" project_id TEXT,\n");
|
||||
|
||||
const stateDir = makeTempDir(tempDirs, "media-persistence-historical-v14-");
|
||||
const env = { OPENCLAW_STATE_DIR: stateDir };
|
||||
|
||||
@@ -26,7 +26,7 @@ describe("legacy media persistence Doctor migration from historical v15", () =>
|
||||
it("converges the exact 509a5f0373764 schema before current-index repair", () => {
|
||||
const historicalSchema = historicalV15AgentSchemaSql();
|
||||
expect(createHash("sha256").update(historicalSchema).digest("hex")).toBe(
|
||||
"2ad94b064159086923e24acf4e11cb77546fca71646e7f49c7a6d40d2a22890a",
|
||||
"75953ef97a738251822fc5aaf283bbe55fbcabe8702ad771892cdafc85d8e6b9",
|
||||
);
|
||||
|
||||
const stateDir = makeTempDir(tempDirs, "media-persistence-historical-v15-");
|
||||
|
||||
@@ -26,7 +26,10 @@ import { CONTEXT_ENGINE_TURN_OUTBOX_TABLE } from "./openclaw-agent-context-engin
|
||||
import { FIRST_USE_ADDITIVE_AGENT_COLUMN_DEFINITIONS } from "./openclaw-agent-db-additive-columns.js";
|
||||
import { OPENCLAW_AGENT_SCHEMA_VERSION } from "./openclaw-agent-db-contract.js";
|
||||
import { OpenClawAgentDatabaseMediaMigrationRequiredError } from "./openclaw-agent-db-migration-required.js";
|
||||
import { ensureSessionEntryValidityProjection } from "./openclaw-agent-db-session-migrations.js";
|
||||
import {
|
||||
ensureSessionEntryValidityProjection,
|
||||
ensureSessionProjectColumn,
|
||||
} from "./openclaw-agent-db-session-migrations.js";
|
||||
import { MESSAGE_TOOL_RUN_OUTCOMES_TABLE } from "./openclaw-agent-message-tool-outcome-schema.js";
|
||||
import {
|
||||
ensureOpenClawAgentProgressCardSchemaInTransaction,
|
||||
@@ -186,6 +189,7 @@ export function repairAndAssertOpenClawAgentV14SchemaForMigration(
|
||||
);
|
||||
}
|
||||
|
||||
ensureSessionProjectColumn(database);
|
||||
ensureSessionEntryValidityProjection(database);
|
||||
ensureSessionKeyContractSchemaInTransaction(database);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user