-- CreateTable
CREATE TABLE "WalkInQR" (
    "id" TEXT NOT NULL,
    "ownerId" TEXT NOT NULL,
    "assignedAdminId" TEXT,
    "createdByAdminId" TEXT,
    "label" TEXT NOT NULL,
    "code" TEXT NOT NULL,
    "qrCodeUrl" TEXT NOT NULL,
    "isActive" BOOLEAN NOT NULL DEFAULT true,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "WalkInQR_code_key" ON "WalkInQR"("code");

-- CreateIndex
CREATE INDEX "WalkInQR_ownerId_idx" ON "WalkInQR"("ownerId");

-- CreateIndex
CREATE INDEX "WalkInQR_assignedAdminId_idx" ON "WalkInQR"("assignedAdminId");

-- AddForeignKey
ALTER TABLE "WalkInQR" ADD CONSTRAINT "WalkInQR_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "Owner"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "WalkInQR" ADD CONSTRAINT "WalkInQR_assignedAdminId_fkey" FOREIGN KEY ("assignedAdminId") REFERENCES "Admin"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "WalkInQR" ADD CONSTRAINT "WalkInQR_createdByAdminId_fkey" FOREIGN KEY ("createdByAdminId") REFERENCES "Admin"("id") ON DELETE SET NULL ON UPDATE CASCADE;
