Skip to main content
Version: 0.24

Interface: Db

Database configuration.

See Databases for seeding and Prisma client customization.

Exampleโ€‹

import { app } from "@wasp.sh/spec"
import devSeed from "./src/dbSeeds" with { type: "ref" }
import { setUpPrisma } from "./src/prisma" with { type: "ref" }

export default app({
// ...
db: {
seeds: [devSeed],
prismaSetupFn: setUpPrisma,
},
})

Propertiesโ€‹

prismaSetupFn?โ€‹

optional prismaSetupFn?: Reference<AnyFunction>

Function that sets up and returns a configured Prisma Client instance. Use this to add Prisma logging or client extensions.

See Prisma's logging and client extensions docs.

Exampleโ€‹

import { PrismaClient } from "@prisma/client"

export const setUpPrisma = () => {
const prisma = new PrismaClient({
log: ["query", "info", "warn", "error"],
})

return prisma
}

seeds?โ€‹

optional seeds?: Reference<AnyFunction>[]

Async functions runnable with wasp db seed [name] to populate the database with initial data. Each function receives Wasp's Prisma Client; the name passed to wasp db seed matches the function's identifier in the import.

See Seeding the Database.