pendantator/api/db/schema.prisma

60 lines
1.8 KiB
Plaintext

// Don't forget to tell Prisma about your edits to this file using
// `yarn rw prisma migrate dev` or `yarn rw prisma db push`.
// `migrate` is like committing while `push` is for prototyping.
// Read more about both here:
// https://www.prisma.io/docs/orm/prisma-migrate
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
// Define your own datamodels here and run `yarn redwood prisma migrate dev`
// to create migrations for them and apply to your dev DB.
model Account {
id String @id @default(cuid())
address ContactAddress @relation(fields: [contactAddressId], references: [id])
active Boolean @default(true) //Are we still supporting this pendant
// We will give a years(?) grace
PaidUp Boolean @default(true) //Have we received a subscription payment this month
contactAddressId String
User User? @relation(fields: [userId], references: [id])
userId String?
}
model ContactAddress {
id String @id @default(cuid())
Name String // name of person who is using the pendant
Address1 String
Address2 String
Address3 String
Town String
PostalCode String
Account Account[]
User User[]
}
model User {
id String @id @default(cuid())
userId String @unique
email String
address ContactAddress @relation(fields: [contactAddressId], references: [id])
contactAddressId String
accounts Account[]
roles Role[]
}
model Role {
id String @id @default(cuid())
name String @unique
User User? @relation(fields: [userId], references: [id])
userId String?
}