Files
kita-planer/prisma/updates/20261007_parent_flows.sql

47 lines
2.0 KiB
SQL

-- HISTORISCHER UPGRADEPFAD: aktuelle Releases verwenden prisma/migrations und deploy/README.md.
-- Nicht zusätzlich zu versionierten Migrationen oder auf bereits aktualisierten Datenbanken ausführen.
-- CreateEnum
CREATE TYPE "RsvpMode" AS ENUM ('CHILD', 'FAMILY');
-- CreateEnum
CREATE TYPE "AnnouncementAudience" AS ENUM ('ELTERN', 'ERZIEHER', 'ALLE');
-- AlterTable
ALTER TABLE "announcements" ADD COLUMN "audience" "AnnouncementAudience" NOT NULL DEFAULT 'ALLE';
-- AlterTable
ALTER TABLE "termine" ADD COLUMN "rsvpMode" "RsvpMode" NOT NULL DEFAULT 'CHILD';
-- CreateTable
CREATE TABLE "family_event_participations" (
"id" TEXT NOT NULL,
"kitaId" TEXT NOT NULL,
"eventId" TEXT NOT NULL,
"familyId" TEXT NOT NULL,
"status" "EventParticipationStatus" NOT NULL,
"adultCount" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "family_event_participations_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "family_event_participations_kitaId_idx" ON "family_event_participations"("kitaId");
-- CreateIndex
CREATE INDEX "family_event_participations_familyId_idx" ON "family_event_participations"("familyId");
-- CreateIndex
CREATE UNIQUE INDEX "family_event_participations_eventId_familyId_key" ON "family_event_participations"("eventId", "familyId");
-- AddForeignKey
ALTER TABLE "family_event_participations" ADD CONSTRAINT "family_event_participations_kitaId_fkey" FOREIGN KEY ("kitaId") REFERENCES "kitas"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "family_event_participations" ADD CONSTRAINT "family_event_participations_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "termine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "family_event_participations" ADD CONSTRAINT "family_event_participations_familyId_fkey" FOREIGN KEY ("familyId") REFERENCES "families"("id") ON DELETE CASCADE ON UPDATE CASCADE;