Files
psp_api/prisma/migrations/20260329141805_init/migration.sql
T

27 lines
1.3 KiB
SQL
Raw Normal View History

2026-03-29 18:06:41 +03:30
/*
Warnings:
- You are about to drop the column `complex_id` on the `customers` table. All the data in the column will be lost.
- You are about to drop the column `complex_id` on the `sales_invoices` table. All the data in the column will be lost.
- Added the required column `pos_id` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `customers` DROP COLUMN `complex_id`;
-- AlterTable
ALTER TABLE `sales_invoices` DROP COLUMN `complex_id`,
ADD COLUMN `pos_id` VARCHAR(191) NOT NULL;
-- AddForeignKey
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;