/*
  Warnings:

  - You are about to drop the column `upiId` on the `loyalty_settings` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "shops" ADD COLUMN "upiId" TEXT;

-- Data migration: move UPI from loyalty settings → shop details
UPDATE "shops" s
SET "upiId" = ls."upiId"
FROM "loyalty_settings" ls
WHERE ls."shopId" = s."id"
  AND ls."upiId" IS NOT NULL
  AND ls."upiId" <> ''
  AND (s."upiId" IS NULL OR s."upiId" = '');

-- AlterTable
ALTER TABLE "loyalty_settings" DROP COLUMN "upiId";
