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 (
|
WITH movement_outlets AS (
|
||||||
SELECT
|
SELECT
|
||||||
poi.purchase_order_id,
|
poi.purchase_order_id,
|
||||||
MIN(im.outlet_id) AS outlet_id
|
MIN(im.outlet_id::text)::uuid AS outlet_id
|
||||||
FROM inventory_movements im
|
FROM inventory_movements im
|
||||||
JOIN purchase_order_items poi ON im.purchase_order_item_id = poi.id
|
JOIN purchase_order_items poi ON im.purchase_order_item_id = poi.id
|
||||||
WHERE im.outlet_id IS NOT NULL
|
WHERE im.outlet_id IS NOT NULL
|
||||||
@ -40,7 +40,7 @@ WITH candidate_item_outlets AS (
|
|||||||
), item_outlets AS (
|
), item_outlets AS (
|
||||||
SELECT
|
SELECT
|
||||||
purchase_order_id,
|
purchase_order_id,
|
||||||
MIN(outlet_id) AS outlet_id
|
MIN(outlet_id::text)::uuid AS outlet_id
|
||||||
FROM candidate_item_outlets
|
FROM candidate_item_outlets
|
||||||
GROUP BY purchase_order_id
|
GROUP BY purchase_order_id
|
||||||
HAVING COUNT(DISTINCT outlet_id) = 1
|
HAVING COUNT(DISTINCT outlet_id) = 1
|
||||||
@ -54,7 +54,7 @@ WHERE po.id = item_outlets.purchase_order_id
|
|||||||
WITH single_outlet_organizations AS (
|
WITH single_outlet_organizations AS (
|
||||||
SELECT
|
SELECT
|
||||||
organization_id,
|
organization_id,
|
||||||
MIN(id) AS outlet_id
|
MIN(id::text)::uuid AS outlet_id
|
||||||
FROM outlets
|
FROM outlets
|
||||||
GROUP BY organization_id
|
GROUP BY organization_id
|
||||||
HAVING COUNT(*) = 1
|
HAVING COUNT(*) = 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user