Skip to content

Instantly share code, notes, and snippets.

@tombowditch
Created March 15, 2023 21:48
Show Gist options
  • Save tombowditch/45bf4e9c424cdbc24a41ad91e8226cb7 to your computer and use it in GitHub Desktop.
Save tombowditch/45bf4e9c424cdbc24a41ad91e8226cb7 to your computer and use it in GitHub Desktop.
generator db {
provider = "go run github.com/stephenafamo/bob/gen/bobgen-prisma"
output = "./prisma"
configFile = "./bobgen.yml"
previewFeatures = ["extendedWhereUnique", "postgresqlExtensions", "fullTextSearch"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [citext]
}
model Business {
id String @id @default(uuid())
name String
description String
slug String @unique
owner User @relation(fields: [ownerId], references: [id])
ownerId String
setup Boolean @default(false)
branding BusinessBranding?
}
model BusinessBranding {
id String @id @default(uuid())
business Business @relation(fields: [businessId], references: [id])
businessId String @unique
logo String?
banner String?
primaryColour String?
secondaryColour String?
}
model User {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
lastLogin DateTime?
twoFactorSecret String?
businesses Business[]
profile UserProfile?
}
model UserProfile {
id String @id @default(uuid())
user User @relation(fields: [userId], references: [id])
userId String @unique
username String @unique @db.Citext
avatar String?
firstName String?
lastName String?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment