Files
SupplierSystem/migrations/20261088_customer_skus_mall_fields.sql
T
Ubuntu 94de4e60de feat(商城管理): 客户商品库后台一期
新增 /customers/mall 卡片管理、Excel 导入、上下架/描述/收藏/移出;复用客户销售价接口;修复共享报价单并发改价、i18n、迁移空 schema、并发计数。
2026-10-28 20:23:43 +08:00

27 lines
869 B
SQL

-- 2026-10-29:商城管理一期:客户商品库可见/上下架与描述。
-- 所有 tenant schema + tenant_template;幂等;不改录单/订单行为。
DO $$
DECLARE
sch text;
BEGIN
FOR sch IN
SELECT nspname FROM pg_namespace
WHERE nspname = 'tenant_template' OR nspname LIKE 'tenant\_%'
LOOP
-- 历史/空 tenant 可能没有 customer_skus;跳过而不是让整个迁移事务因 42P01 回滚
IF EXISTS (
SELECT 1 FROM information_schema.tables
WHERE table_schema = sch AND table_name = 'customer_skus'
) THEN
EXECUTE format(
'ALTER TABLE %I.customer_skus ADD COLUMN IF NOT EXISTS is_listed BOOLEAN NOT NULL DEFAULT true',
sch
);
EXECUTE format(
'ALTER TABLE %I.customer_skus ADD COLUMN IF NOT EXISTS description TEXT',
sch
);
END IF;
END LOOP;
END $$;