fix: migration 82
This commit is contained in:
parent
ac06a4bbe9
commit
503fb5734f
@ -7,7 +7,7 @@ ON purchase_orders(outlet_id);
|
||||
WITH movement_outlets AS (
|
||||
SELECT
|
||||
poi.purchase_order_id,
|
||||
MIN(im.outlet_id) AS outlet_id
|
||||
MIN(im.outlet_id::text)::uuid AS outlet_id
|
||||
FROM inventory_movements im
|
||||
JOIN purchase_order_items poi ON im.purchase_order_item_id = poi.id
|
||||
WHERE im.outlet_id IS NOT NULL
|
||||
@ -40,7 +40,7 @@ WITH candidate_item_outlets AS (
|
||||
), item_outlets AS (
|
||||
SELECT
|
||||
purchase_order_id,
|
||||
MIN(outlet_id) AS outlet_id
|
||||
MIN(outlet_id::text)::uuid AS outlet_id
|
||||
FROM candidate_item_outlets
|
||||
GROUP BY purchase_order_id
|
||||
HAVING COUNT(DISTINCT outlet_id) = 1
|
||||
@ -54,7 +54,7 @@ WHERE po.id = item_outlets.purchase_order_id
|
||||
WITH single_outlet_organizations AS (
|
||||
SELECT
|
||||
organization_id,
|
||||
MIN(id) AS outlet_id
|
||||
MIN(id::text)::uuid AS outlet_id
|
||||
FROM outlets
|
||||
GROUP BY organization_id
|
||||
HAVING COUNT(*) = 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user