()
| 69 | }; |
| 70 | |
| 71 | const 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 | |
| 87 | const seedLegacyScopedSqlite = async (dataDir: string, scopeId: string): Promise<void> => { |
| 88 | const db = new Database(join(dataDir, "data.db")); |
no test coverage detected