cal.pub0.org/prisma/migrations/20210908042159_teams_feature/migration.sql

31 lines
967 B
SQL

-- CreateEnum
CREATE TYPE "SchedulingType" AS ENUM ('roundRobin', 'collective');
-- DropForeignKey
ALTER TABLE "EventType" DROP CONSTRAINT "EventType_userId_fkey";
-- AlterTable
ALTER TABLE "EventType" ADD COLUMN "schedulingType" "SchedulingType",
ADD COLUMN "teamId" INTEGER;
-- CreateTable
CREATE TABLE "_user_eventtype" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "_user_eventtype_AB_unique" ON "_user_eventtype"("A", "B");
-- CreateIndex
CREATE INDEX "_user_eventtype_B_index" ON "_user_eventtype"("B");
-- AddForeignKey
ALTER TABLE "EventType" ADD FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_user_eventtype" ADD FOREIGN KEY ("A") REFERENCES "EventType"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_user_eventtype" ADD FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;