calcom/packages/prisma/migrations/20210813142905_event_payment/migration.sql
Omar López fe35cf6570
Extract prisma to it's own package ()
* Moved prisma to packages

* Add missing prisma configs

* Extracts common libs and types

* Build and pipeline fixes

* Adds missing package

* Prisma scripts cleanup

* Updates lint staged

* Type fixes

* Sort imports

* Updates yarn lock file

* Fixes for yarn dx

* Revert "Sort imports"

This reverts commit 076109decab9b9ba307fc03696c3b0da5c4896f3.

* Formatting

* Prevent double TS version

* Fix conflict

* Extracted e2e configs
2022-02-15 13:30:52 -07:00

35 lines
1,002 B
SQL

-- CreateEnum
CREATE TYPE "PaymentType" AS ENUM ('STRIPE');
-- AlterTable
ALTER TABLE "Booking" ADD COLUMN "paid" BOOLEAN NOT NULL DEFAULT false;
-- AlterTable
ALTER TABLE "EventType" ADD COLUMN "currency" TEXT NOT NULL DEFAULT E'usd',
ADD COLUMN "price" INTEGER NOT NULL DEFAULT 0;
-- CreateTable
CREATE TABLE "Payment" (
"id" SERIAL NOT NULL,
"uid" TEXT NOT NULL,
"type" "PaymentType" NOT NULL,
"bookingId" INTEGER NOT NULL,
"amount" INTEGER NOT NULL,
"fee" INTEGER NOT NULL,
"currency" TEXT NOT NULL,
"success" BOOLEAN NOT NULL,
"refunded" BOOLEAN NOT NULL,
"data" JSONB NOT NULL,
"externalId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Payment.uid_unique" ON "Payment"("uid");
-- CreateIndex
CREATE UNIQUE INDEX "Payment.externalId_unique" ON "Payment"("externalId");
-- AddForeignKey
ALTER TABLE "Payment" ADD FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE CASCADE ON UPDATE CASCADE;