Files
SupplierSystem/migrations/20261061_quote_price_proposals_applied.sql
Ubuntu 0f5f992f9c
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
fix(报价单): 补 quote_price_proposals.applied 列(逐行审批进度)
本地报 column "applied" does not exist:逐行通过/驳回用 applied 存 approved_codes/rejected_codes,
但租户表没有该列。迁移:tenant_template + 所有 tenant_% schema 加 applied JSONB(可重放)。
2026-10-19 14:30:39 +08:00

29 lines
1.2 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 报价提议补 `applied`(2026-10-19:逐行通过/驳回进度)
--
-- 背景:审核支持「每行单独通过/驳回」,处理完的行从 items 移出,另需记录
-- `approved_codes` / `rejected_codes` 以便混合结果(有通过 ⇒ 终态已通过)与回执。
-- 用法与主系统 `supplier_quote_price_proposals.applied` 对齐;可重放:ADD COLUMN IF NOT EXISTS。
ALTER TABLE IF EXISTS tenant_template.quote_price_proposals
ADD COLUMN IF NOT EXISTS applied JSONB;
COMMENT ON COLUMN tenant_template.quote_price_proposals.applied IS
'逐行审批进度:{approved_codes:[配送SKU], rejected_codes:[配送SKU]};为空表示尚未处理';
DO $$
DECLARE
s TEXT;
BEGIN
FOR s IN
SELECT schema_name FROM information_schema.schemata
WHERE schema_name LIKE 'tenant\_%' ESCAPE '\'
AND schema_name <> 'tenant_template'
LOOP
EXECUTE format('ALTER TABLE IF EXISTS %I.quote_price_proposals ADD COLUMN IF NOT EXISTS applied JSONB', s);
EXECUTE format(
'COMMENT ON COLUMN %I.quote_price_proposals.applied IS %L', s,
'逐行审批进度:{approved_codes:[配送SKU], rejected_codes:[配送SKU]};为空表示尚未处理'
);
END LOOP;
END $$;