Skip to content

Function: createServerDb()

createServerDb<S>(options): Db<S>

Defined in: server/src/server-db.ts:25

Build a Db bound to the SQL driver.

Change-log recording is automatic: every user table has AFTER INSERT / UPDATE / DELETE triggers created by ensureSchema, so any write — whether via this Db, via a raw drizzle instance, or via wrangler d1 execute — lands in the change log and reaches subscribing clients.

Server-side background jobs (scheduled(...)) should still prefer this helper because it uses the same isomorphic DSL as your mutators.

S extends Record<string, AnyTable>

ServerDbOptions<S>

Db<S>