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

22 lines
1.1 KiB
SQL
Raw Normal View History

/*
Warnings:
- The primary key for the `Stock_Balance` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `ProductId` on the `Stock_Balance` table. All the data in the column will be lost.
- Added the required column `inventoryId` to the `Stock_Balance` table without a default value. This is not possible if the table is not empty.
- Added the required column `productId` to the `Stock_Balance` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Stock_Balance` DROP PRIMARY KEY,
DROP COLUMN `ProductId`,
ADD COLUMN `inventoryId` INTEGER NOT NULL,
ADD COLUMN `productId` INTEGER NOT NULL,
ADD PRIMARY KEY (`productId`);
-- AddForeignKey
ALTER TABLE `Stock_Balance` ADD CONSTRAINT `Stock_Balance_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Stock_Balance` ADD CONSTRAINT `Stock_Balance_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;