MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / cleanDatabase

Function cleanDatabase

apps/api/tests/helpers/db.ts:154–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152 * flake-deadlocks.
153 */
154export const cleanDatabase = async (): Promise<void> => {
155 await db.transaction(async (tx) => {
156 await tx.execute(
157 sql`SELECT pg_advisory_xact_lock(${sql.raw(
158 String(CLEANUP_ADVISORY_LOCK_KEY)
159 )})`
160 );
161
162 for (const table of CLEANUP_TARGETS) {
163 await tx.execute(sql.raw(`DELETE FROM ${table}`));
164 }
165 });
166};
167
168/** Re-export the live `db` for convenience inside test files. */
169export { db };

Calls

no outgoing calls

Tested by

no test coverage detected