Files
OmniRoute/scripts/scratch/test-migrations.ts
diegosouzapw 0f35c148ea feat(compression): expand caveman compression and analytics pipeline
Add caveman intensity levels, output mode instructions, validation, and
preview diffs across the compression pipeline.

Extend MCP and dashboard settings to support auto-trigger mode, system
prompt preservation, MCP description compression, and caveman rule
metadata. Record richer compression analytics with receipt fields,
validation fallbacks, output mode data, and add the related database
migration.

Improve preservation handling for code, URLs, markdown, math, and other
protected content while adding broad unit, integration, and golden-set
coverage for caveman parity and compression behavior.
2026-05-02 12:39:04 -03:00

57 lines
1.2 KiB
TypeScript

import Database from "better-sqlite3";
import { runMigrations, getMigrationStatus } from "../../src/lib/db/migrationRunner.js";
const db = new Database("/tmp/test-migrations.sqlite");
db.exec(
"CREATE TABLE _omniroute_migrations (version TEXT PRIMARY KEY, name TEXT NOT NULL, applied_at TEXT NOT NULL DEFAULT (datetime('now')))"
);
const fakeApplied = [
"001",
"002",
"003",
"004",
"005",
"006",
"007",
"008",
"009",
"010",
"011",
"012",
"013",
"014",
"015",
"016",
"017",
"018",
"019",
"020",
"021",
];
for (const v of fakeApplied) {
db.prepare("INSERT INTO _omniroute_migrations (version, name) VALUES (?, ?)").run(v, "fake_" + v);
}
db.prepare("INSERT INTO _omniroute_migrations (version, name) VALUES (?, ?)").run(
"026",
"call_logs_cache_source"
);
db.prepare("INSERT INTO _omniroute_migrations (version, name) VALUES (?, ?)").run(
"029",
"provider_connection_max_concurrent"
);
console.log(
"Status before:",
getMigrationStatus(db).pending.map((p) => p.version)
);
try {
runMigrations(db, { isNewDb: false });
} catch (e: any) {
console.error("Error:", e.message);
}
console.log(
"Status after:",
getMigrationStatus(db).pending.map((p) => p.version)
);