Skip to content

Commit

Permalink
new prisma migration
Browse files Browse the repository at this point in the history
  • Loading branch information
subru-37 committed Oct 25, 2024
1 parent 2d16109 commit 3d3053c
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- CreateTable
CREATE TABLE "Registrant" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"firstName" TEXT NOT NULL,
"lastName" TEXT,
"email" TEXT NOT NULL,
"phone" TEXT,
"eventId" UUID NOT NULL,
"organizationId" TEXT NOT NULL,

CONSTRAINT "Registrant_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "RegistrantAttributes" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"value" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"registrantId" UUID NOT NULL,
"attributeId" UUID NOT NULL,

CONSTRAINT "RegistrantAttributes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "RegistrantExtras" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"registrantId" UUID NOT NULL,
"extraId" UUID NOT NULL,

CONSTRAINT "RegistrantExtras_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "Registrant" ADD CONSTRAINT "Registrant_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Registrant" ADD CONSTRAINT "Registrant_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "RegistrantAttributes" ADD CONSTRAINT "RegistrantAttributes_registrantId_fkey" FOREIGN KEY ("registrantId") REFERENCES "Registrant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "RegistrantAttributes" ADD CONSTRAINT "RegistrantAttributes_attributeId_fkey" FOREIGN KEY ("attributeId") REFERENCES "Attributes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "RegistrantExtras" ADD CONSTRAINT "RegistrantExtras_registrantId_fkey" FOREIGN KEY ("registrantId") REFERENCES "Registrant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "RegistrantExtras" ADD CONSTRAINT "RegistrantExtras_extraId_fkey" FOREIGN KEY ("extraId") REFERENCES "Extras"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

0 comments on commit 3d3053c

Please sign in to comment.