28 lines
1.1 KiB
SQL
28 lines
1.1 KiB
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`catalog_componentPrepare`()
|
|
BEGIN
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
|
CREATE TEMPORARY TABLE tmp.ticketComponent (
|
|
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
`itemFk` INT NOT NULL,
|
|
`componentFk` INT UNSIGNED NOT NULL,
|
|
`cost` DECIMAL(10,4) NOT NULL,
|
|
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)
|
|
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
|
CREATE TEMPORARY TABLE tmp.ticketComponentPrice (
|
|
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
`itemFk` INT NOT NULL,
|
|
`rate` INT NOT NULL,
|
|
`grouping` INT UNSIGNED NOT NULL,
|
|
`price` DECIMAL(10,4) NOT NULL,
|
|
`priceKg` DECIMAL(10,4),
|
|
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC)
|
|
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
END$$
|
|
DELIMITER ;
|