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

Function hasDrizzleMigrationHistory

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

Source from the content-addressed store, hash-verified

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