-- CreateTable
CREATE TABLE "rayon_provinces" (
    "rayon_id" TEXT NOT NULL,
    "province_id" TEXT NOT NULL,
    "assigned_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "rayon_provinces_pkey" PRIMARY KEY ("rayon_id","province_id")
);

-- CreateIndex
CREATE INDEX "rayon_provinces_rayon_id_idx" ON "rayon_provinces"("rayon_id");

-- CreateIndex
CREATE INDEX "rayon_provinces_province_id_idx" ON "rayon_provinces"("province_id");

-- AddForeignKey
ALTER TABLE "rayon_provinces" ADD CONSTRAINT "rayon_provinces_rayon_id_fkey" FOREIGN KEY ("rayon_id") REFERENCES "rayons"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "rayon_provinces" ADD CONSTRAINT "rayon_provinces_province_id_fkey" FOREIGN KEY ("province_id") REFERENCES "provinces"("id") ON DELETE CASCADE ON UPDATE CASCADE;
