-- CreateTable CREATE TABLE "Invite" ( "id" SERIAL NOT NULL, "code" TEXT NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "expires_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "used" BOOLEAN NOT NULL DEFAULT false, "createdById" INTEGER NOT NULL, CONSTRAINT "Invite_pkey" PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "Invite_code_key" ON "Invite"("code"); -- AddForeignKey ALTER TABLE "Invite" ADD CONSTRAINT "Invite_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;