Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is your Prisma schema file,
- // learn more about it in the docs: https://pris.ly/d/prisma-schema
- generator client {
- provider = "prisma-client-js"
- }
- datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
- }
- model User {
- id String @id @unique
- name String
- email String @unique
- // subscriptions Subscription[]
- }
- enum SUBSCRIPTION_CURRENCY {
- PLN
- USD
- EUR
- }
- enum SUBSCRIPTION_BILLING_PERIOD {
- MONTHLY
- QUARTERLY
- YEARLY
- }
- enum SUBSCRIPTION_STATUS {
- ACTIVE
- NOT_ACTIVE
- // CANCELLED
- // EXPIRED
- }
- model Subscription {
- id String @id @default(uuid())
- name String
- price Float
- currency SUBSCRIPTION_CURRENCY // Tworzymy enum z walutami.
- startDate DateTime
- endDate DateTime? // Opcjonalne
- billingPeriod SUBSCRIPTION_BILLING_PERIOD // Tworzymy enum z okresem rozliczeniowym.
- next_payment_date DateTime
- category String
- avatar_url String
- status SUBSCRIPTION_STATUS // Tworzymy enum ze statusem.
- ownerId String
- owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
- payments Payment[]
- }
- enum PAYMENT_STATUS {
- PAID
- NOT_PAID
- }
- model Payment {
- id String @id @default(uuid())
- amount Float
- due_date DateTime @db.Date
- status PAYMENT_STATUS @default(NOT_PAID)
- subscriptionId String
- subscription Subscription @relation(fields: [subscriptionId], references: [id], onDelete: Cascade)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement