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

Function hasDrizzleMigrationHistory

apps/cloud/scripts/dev-db.ts:58–72  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

56}
57
58async function hasDrizzleMigrationHistory(path: string): Promise<boolean> {
59 if (!existsSync(path)) return true;
60
61 const db = await PGlite.create(path);
62 const result = await db.query<{ exists: boolean }>(`
63 SELECT EXISTS (
64 SELECT 1
65 FROM information_schema.tables
66 WHERE table_schema = 'drizzle'
67 AND table_name = '__drizzle_migrations'
68 ) AS "exists"
69 `);
70 await db.close();
71 return result.rows[0]?.exists === true;
72}
73
74if (!(await hasDrizzleMigrationHistory(DB_PATH))) {
75 console.log("[dev-db] Resetting dev database without Drizzle migration history");

Callers 1

dev-db.tsFile · 0.85

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected