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?โ
optionalprismaSetupFn?: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?โ
optionalseeds?: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.