-- CreateTable
CREATE TABLE "TicketSeat" (
    "id" TEXT NOT NULL,
    "ticketId" TEXT NOT NULL,
    "seatId" TEXT NOT NULL,
    "seatIndex" INTEGER NOT NULL DEFAULT 0,

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

-- CreateIndex
CREATE INDEX "TicketSeat_ticketId_idx" ON "TicketSeat"("ticketId");

-- CreateIndex
CREATE INDEX "TicketSeat_seatId_idx" ON "TicketSeat"("seatId");

-- AddForeignKey
ALTER TABLE "TicketSeat" ADD CONSTRAINT "TicketSeat_ticketId_fkey" FOREIGN KEY ("ticketId") REFERENCES "Ticket"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "TicketSeat" ADD CONSTRAINT "TicketSeat_seatId_fkey" FOREIGN KEY ("seatId") REFERENCES "Seat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
