/*
  Warnings:

  - A unique constraint covering the columns `[name,cityId,companyId]` on the table `Area` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[name,companyId]` on the table `City` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "obm_core"."Area_name_cityId_key";

-- DropIndex
DROP INDEX "obm_core"."City_name_key";

-- AlterTable
ALTER TABLE "obm_core"."Area" ADD COLUMN     "companyId" TEXT;

-- AlterTable
ALTER TABLE "obm_core"."City" ADD COLUMN     "companyId" TEXT;

-- CreateIndex
CREATE UNIQUE INDEX "Area_name_cityId_companyId_key" ON "obm_core"."Area"("name", "cityId", "companyId");

-- CreateIndex
CREATE UNIQUE INDEX "City_name_companyId_key" ON "obm_core"."City"("name", "companyId");

-- AddForeignKey
ALTER TABLE "obm_core"."City" ADD CONSTRAINT "City_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "obm_core"."Company"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "obm_core"."Area" ADD CONSTRAINT "Area_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "obm_core"."Company"("id") ON DELETE SET NULL ON UPDATE CASCADE;
