diff --git a/packages/prisma/migrations/20230125175109_remove_type_from_payment_and_add_app_relationship/migration.sql b/packages/prisma/migrations/20230125175109_remove_type_from_payment_and_add_app_relationship/migration.sql deleted file mode 100644 index 8dc7d759b9..0000000000 --- a/packages/prisma/migrations/20230125175109_remove_type_from_payment_and_add_app_relationship/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `type` on the `Payment` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Payment" DROP COLUMN "type", -ADD COLUMN "appId" TEXT; - --- DropEnum -DROP TYPE "PaymentType"; - --- AddForeignKey -ALTER TABLE "Payment" ADD CONSTRAINT "Payment_appId_fkey" FOREIGN KEY ("appId") REFERENCES "App"("slug") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index 043f4f16a2..cd6b135753 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -399,20 +399,24 @@ model ReminderMail { createdAt DateTime @default(now()) } +enum PaymentType { + STRIPE +} + model Payment { - id Int @id @default(autoincrement()) - uid String @unique - app App? @relation(fields: [appId], references: [slug], onDelete: Cascade) - appId String? + id Int @id @default(autoincrement()) + uid String @unique + // TODO: Use an App relationship instead of PaymentType enum? + type PaymentType bookingId Int - booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade) + booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade) amount Int fee Int currency String success Boolean refunded Boolean data Json - externalId String @unique + externalId String @unique } enum WebhookTriggerEvents { @@ -521,7 +525,6 @@ model App { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt credentials Credential[] - payments Payment[] Webhook Webhook[] ApiKey ApiKey[] enabled Boolean @default(false)