Files
psp_api/prisma/migrations/20260406153630_init/migration.sql
T
2026-04-06 21:12:07 +03:30

26 lines
1.1 KiB
SQL

/*
Warnings:
- A unique constraint covering the columns `[license_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[consumer_id]` on the table `licenses` will be added. If there are existing duplicate values, this will fail.
- Added the required column `consumer_id` to the `licenses` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE `consumers` DROP FOREIGN KEY `consumers_license_id_fkey`;
-- DropIndex
DROP INDEX `consumers_license_id_fkey` ON `consumers`;
-- AlterTable
ALTER TABLE `licenses` ADD COLUMN `consumer_id` VARCHAR(191) NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX `consumers_license_id_key` ON `consumers`(`license_id`);
-- CreateIndex
CREATE UNIQUE INDEX `licenses_consumer_id_key` ON `licenses`(`consumer_id`);
-- AddForeignKey
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;