/*
  Warnings:

  - A unique constraint covering the columns `[identifier]` on the table `leads` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `identifier` to the `leads` table without a default value. This is not possible if the table is not empty.
  - Made the column `origin_id` on table `leads` required. This step will fail if there are existing NULL values in that column.

*/
-- DropIndex
DROP INDEX `leads_email_key` ON `leads`;

-- DropIndex
DROP INDEX `leads_origin_id_fkey` ON `leads`;

-- AlterTable
ALTER TABLE `leads` ADD COLUMN `identifier` VARCHAR(191) NOT NULL,
    MODIFY `origin_id` VARCHAR(191) NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX `leads_identifier_key` ON `leads`(`identifier`);

-- AddForeignKey
ALTER TABLE `leads` ADD CONSTRAINT `leads_origin_id_fkey` FOREIGN KEY (`origin_id`) REFERENCES `origins`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
