71 lines
2.2 KiB
Plaintext
71 lines
2.2 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[]
|
|
UserToContactAddress UserToContactAddress[]
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
userId String @unique
|
|
email String
|
|
hashedPassword String
|
|
salt String
|
|
resetToken String?
|
|
resetTokenExpiresAt DateTime?
|
|
accounts Account[]
|
|
roles Role[]
|
|
UserToContactAddress UserToContactAddress[]
|
|
}
|
|
|
|
model UserToContactAddress {
|
|
id Int @id
|
|
user User @relation(fields: [userId], references: [id])
|
|
address ContactAddress @relation(fields: [contactAddressId], references: [id])
|
|
userId String
|
|
contactAddressId String
|
|
}
|
|
|
|
model Role {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
User User? @relation(fields: [userId], references: [id])
|
|
userId String?
|
|
}
|