master #2811
|
@ -30,12 +30,12 @@ BEGIN
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
WHERE iss.itemShelvingFk = vItemShelvingFk
|
WHERE iss.itemShelvingFk = vItemShelvingFk
|
||||||
AND iss.itemFk = vItemFk
|
AND ish.itemFk = vItemFk
|
||||||
AND NOT iss.isPicked
|
AND NOT iss.isPicked
|
||||||
FOR UPDATE;
|
FOR UPDATE;
|
||||||
|
|
||||||
INSERT INTO itemShelvingSaleReserve (saleFk, vSectorFk)
|
INSERT INTO itemShelvingSaleReserve (saleFk, sectorFk)
|
||||||
SELECT DISTINCT iss.saleFk
|
SELECT DISTINCT iss.saleFk, vSectorFk
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
WHERE iss.itemShelvingFk = vItemShelvingFk
|
WHERE iss.itemShelvingFk = vItemShelvingFk
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
|
||||||
|
ALTER TABLE vn.itemShelvingSaleReserve DROP FOREIGN KEY IF EXISTS itemShelvingSaleReserve_sector_FK;
|
||||||
|
|
||||||
|
ALTER TABLE vn.itemShelvingSaleReserve ADD CONSTRAINT itemShelvingSaleReserve_sector_FK
|
||||||
|
FOREIGN KEY IF NOT EXISTS (sectorFk) REFERENCES vn.sector(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
Loading…
Reference in New Issue