All files / apps / api/src / db client.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13          262x         5x    
import { drizzle, type DrizzleD1Database } from 'drizzle-orm/d1'
 
// The Worker reaches D1 through the bindings in wrangler.jsonc, not a connection string.
// Routes and services get a database from here, never from the binding (design 8.2 rules).
export function mainDb(env: Env): DrizzleD1Database {
  return drizzle(env.DB)
}
 
// FTS5 tables live only in the search D1 (design #28).
export function searchDb(env: Env): DrizzleD1Database {
  return drizzle(env.SEARCH_DB)
}