MCPcopy
hub / github.com/dittofeed/dittofeed / db

Function db

packages/backend-lib/src/db.ts:106–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104}
105
106export function db(): Db {
107 if (POOL_ENDED) {
108 throw new Error("Database already ended");
109 }
110 if (!DB) {
111 const dbSchema = {
112 ...schema,
113 ...relations,
114 };
115 const d = drizzle({
116 client: pool(),
117 schema: dbSchema,
118 });
119 DB = d;
120 return d;
121 }
122 return DB;
123}
124
125export type KeysOfType<T, U> = {
126 [K in keyof T]: T[K] extends U ? K : never;

Callers 15

createCommandsFunction · 0.90
upgradeV010PreFunction · 0.90
upgradeV010PostFunction · 0.90
resetWorkspaceDataFunction · 0.90
readPeriodsFunction · 0.90
upsertSubscriptionGroupFunction · 0.90
updateUserSubscriptionsFunction · 0.90
findAllUserPropertiesFunction · 0.90

Calls 1

poolFunction · 0.85

Tested by 2

upsertJourneysFunction · 0.72
upsertComputedPropertiesFunction · 0.72