From 6eca7d948e78adb253f4d153a412c71fca2ea8e3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 21 Sep 2022 15:48:49 +0200 Subject: [PATCH] add migration --- .../migration.sql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 apps/api/prisma/migrations/20220921134841_custom_certificate/migration.sql diff --git a/apps/api/prisma/migrations/20220921134841_custom_certificate/migration.sql b/apps/api/prisma/migrations/20220921134841_custom_certificate/migration.sql new file mode 100644 index 000000000..4a858e5d4 --- /dev/null +++ b/apps/api/prisma/migrations/20220921134841_custom_certificate/migration.sql @@ -0,0 +1,22 @@ +-- CreateTable +CREATE TABLE "Certificate" ( + "id" TEXT NOT NULL PRIMARY KEY, + "key" TEXT NOT NULL, + "cert" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL +); + +-- CreateTable +CREATE TABLE "_CertificateToTeam" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + CONSTRAINT "_CertificateToTeam_A_fkey" FOREIGN KEY ("A") REFERENCES "Certificate" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "_CertificateToTeam_B_fkey" FOREIGN KEY ("B") REFERENCES "Team" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateIndex +CREATE UNIQUE INDEX "_CertificateToTeam_AB_unique" ON "_CertificateToTeam"("A", "B"); + +-- CreateIndex +CREATE INDEX "_CertificateToTeam_B_index" ON "_CertificateToTeam"("B");