Skip to content

@bight-ts/storage-prisma

import { createPrismaStorageAdapter } from "@bight-ts/storage-prisma";

Creates a StorageAdapter that persists Bight state using Prisma model delegates.

PropertyTypeRequiredDescription
globalConfigsPrisma delegateYesA Prisma model delegate (e.g, prisma.globalConfig) with findUnique and upsert methods. Model must have a key: String @id and value: Json field.
guildConfigsPrisma delegateYesA Prisma model delegate with findUnique and upsert. Model must have a guildId: String @id and value: Json field.
model GlobalConfig {
key String @id
value Json
}
model GuildConfig {
guildId String @id @map("guild_id")
value Json
}
  • Global values are stored as individual rows keyed by key.
  • Guild values are stored as a single JSON object per guild, keyed by guildId.
  • The adapter uses findUnique + upsert — no raw SQL.