allow organizations to have multiple subscriptions. although only 1 can be active at a time
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Made the column `organizationId` on table `Subscription` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "Subscription_organizationId_unique";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Subscription" ALTER COLUMN "organizationId" SET NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ALTER COLUMN "fullName" DROP DEFAULT;
|
@ -30,7 +30,7 @@ model Organization {
|
||||
messages Message[]
|
||||
phoneCalls PhoneCall[]
|
||||
processingPhoneNumbers ProcessingPhoneNumber[]
|
||||
subscription Subscription?
|
||||
subscriptions Subscription[]
|
||||
|
||||
@@unique([id, twilioAccountSid])
|
||||
}
|
||||
@ -50,8 +50,8 @@ model Subscription {
|
||||
nextBillDate DateTime @db.Date
|
||||
lastEventTime DateTime @db.Timestamp
|
||||
|
||||
organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
organizationId String?
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
organizationId String
|
||||
}
|
||||
|
||||
enum SubscriptionStatus {
|
||||
@ -95,7 +95,7 @@ model User {
|
||||
id String @id @default(uuid())
|
||||
createdAt DateTime @default(now()) @db.Timestamptz
|
||||
updatedAt DateTime @updatedAt @db.Timestamptz
|
||||
fullName String @default("")
|
||||
fullName String
|
||||
email String @unique
|
||||
hashedPassword String?
|
||||
role GlobalRole @default(CUSTOMER)
|
||||
|
Reference in New Issue
Block a user