-- CreateTable
CREATE TABLE "subadmin_shops" (
    "userId" TEXT NOT NULL,
    "shopId" TEXT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "subadmin_shops_pkey" PRIMARY KEY ("userId","shopId")
);

-- CreateIndex
CREATE INDEX "subadmin_shops_shopId_idx" ON "subadmin_shops"("shopId");

-- AddForeignKey
ALTER TABLE "subadmin_shops" ADD CONSTRAINT "subadmin_shops_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "subadmin_shops" ADD CONSTRAINT "subadmin_shops_shopId_fkey" FOREIGN KEY ("shopId") REFERENCES "shops"("id") ON DELETE CASCADE ON UPDATE CASCADE;
