-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
packages/database/prisma/migrations/20241025092424_registration/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |