openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
50 lines (49 loc) • 1.52 kB
JavaScript
import { i as withEngineStoreAdmission } from "./admission-scope-DmxaPNhm.mjs";
import { t as _usingCtx } from "./usingCtx-rhpPzaNq.mjs";
import { n as openNodeSqliteDatabase } from "./node-sqlite-CU4puofF.mjs";
import { n as readEngineAnchor, t as openEngineStore } from "./open-jth9KEHn.mjs";
import { n as withLegacyPostgresIndexOrdering } from "./postgres-index-ordering-CLLgXtNR.mjs";
//#region src/infra/database-engine/historical-index-ordering-port.ts
/** Restore the previous generated index policy without upgrading a recovery image. */
function historicalIndexOrderingPort(e, t, n, r = "sqlite") {
return {
...e,
version: t,
postData: withLegacyPostgresIndexOrdering(e.postData, r, e.preData),
inspectSqliteSource: void 0,
migrateSqliteSource: void 0,
admit(i, a) {
if (!a) return;
withEngineStoreAdmission(() => {
try {
var o = _usingCtx();
const s = o.u(openNodeSqliteDatabase(i));
const c = openEngineStore({
anchor: s,
input: a,
schema: {
id: e.id,
version: t,
sqlite: e.sqlite,
postgres: withLegacyPostgresIndexOrdering(n, r)
},
existingOnly: true,
inspectSqlite: () => ({
hasEngineAnchor: Boolean(readEngineAnchor(s)),
hasExistingData: false
}),
prepareAnchor: () => {},
openSqlite: () => {}
});
if (c !== s) c.close();
} catch (e) {
o.e = e;
} finally {
o.d();
}
});
}
};
}
//#endregion
export { historicalIndexOrderingPort as t };