Add SQL query for average cost retrieval and generate TriggerLog model
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `stockBalanceId` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the `_StockBalance_inventory` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `_StockBalance_product` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `_StockBalance_inventory` DROP FOREIGN KEY `_StockBalance_inventory_A_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `_StockBalance_inventory` DROP FOREIGN KEY `_StockBalance_inventory_B_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `_StockBalance_product` DROP FOREIGN KEY `_StockBalance_product_A_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `_StockBalance_product` DROP FOREIGN KEY `_StockBalance_product_B_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Products` DROP COLUMN `stockBalanceId`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Stock_Movements` ADD COLUMN `supplierId` INTEGER NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `_StockBalance_inventory`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `_StockBalance_product`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Stock_Movements` ADD CONSTRAINT `Stock_Movements_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- 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;
|
||||
Reference in New Issue
Block a user