calcom/prisma/migrations/20210813142905_event_payment/migration.sql
Omar López 3add84a279
Adds Stripe integration (#717)
* Adds Stripe integration

* Moves Stripe instrucctions to ee

* Adds NEXT_PUBLIC_APP_URL variable

* Adds fallback for NEXT_PUBLIC_APP_URL

* Throws error objects instead

* Improved error handling

* Removes deprecated method

* Bug fixing

* Payment refactoring

* PaymentPage fixes

* Fixes preview links

* More preview link fixes

* Fixes client links

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2021-09-22 19:36:13 +01: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;