MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / readLegacyMigrations

Function readLegacyMigrations

apps/desktop/scripts/smoke-sidecar.ts:71–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69};
70
71const readLegacyMigrations = async (): Promise<readonly { sql: string; hash: string }[]> => {
72 const journal = (await Bun.file(join(APPS_LOCAL_DRIZZLE, "meta/_journal.json")).json()) as {
73 readonly entries: readonly { readonly idx: number; readonly tag: string }[];
74 };
75
76 const migrations: { sql: string; hash: string }[] = [];
77 for (const entry of [...journal.entries].sort((left, right) => left.idx - right.idx)) {
78 const query = await Bun.file(join(APPS_LOCAL_DRIZZLE, `${entry.tag}.sql`)).text();
79 migrations.push({
80 sql: query,
81 hash: createHash("sha256").update(query).digest("hex"),
82 });
83 }
84 return migrations;
85};
86
87const seedLegacyScopedSqlite = async (dataDir: string, scopeId: string): Promise<void> => {
88 const db = new Database(join(dataDir, "data.db"));

Callers 1

seedLegacyScopedSqliteFunction · 0.85

Calls 4

pushMethod · 0.80
jsonMethod · 0.65
textMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected