mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
35 lines
1.1 KiB
PL/PgSQL
35 lines
1.1 KiB
PL/PgSQL
BEGIN;
|
|
|
|
INSERT INTO fifo_stock_v2_route_rules(
|
|
flag_group_code,
|
|
lane,
|
|
function_code,
|
|
source_table,
|
|
source_id_column,
|
|
product_warehouse_col,
|
|
quantity_col,
|
|
used_quantity_col,
|
|
pending_quantity_col,
|
|
scope_sql,
|
|
legacy_type_key,
|
|
allow_pending_default,
|
|
is_active
|
|
)
|
|
VALUES
|
|
('AYAM', 'USABLE', 'CHICKIN_OUT', 'project_chickins', 'id', 'product_warehouse_id', 'usage_qty', NULL, 'pending_usage_qty', 'deleted_at IS NULL', 'PROJECT_CHICKIN', TRUE, TRUE)
|
|
ON CONFLICT (flag_group_code, lane, function_code, source_table) DO UPDATE
|
|
SET
|
|
source_id_column = EXCLUDED.source_id_column,
|
|
product_warehouse_col = EXCLUDED.product_warehouse_col,
|
|
quantity_col = EXCLUDED.quantity_col,
|
|
used_quantity_col = EXCLUDED.used_quantity_col,
|
|
pending_quantity_col = EXCLUDED.pending_quantity_col,
|
|
scope_sql = EXCLUDED.scope_sql,
|
|
legacy_type_key = EXCLUDED.legacy_type_key,
|
|
allow_pending_default = EXCLUDED.allow_pending_default,
|
|
updated_at = NOW(),
|
|
-- Keep existing is_active (do not override disable migration if it was intentional).
|
|
is_active = fifo_stock_v2_route_rules.is_active;
|
|
|
|
COMMIT;
|