fix(cost-center): 修复启用人工作废商品配置
This commit is contained in:
@@ -92,10 +92,21 @@ $$;
|
||||
|
||||
DROP TRIGGER IF EXISTS trg_manual_config_product_source ON manual_fulfillment_configs;
|
||||
CREATE TRIGGER trg_manual_config_product_source
|
||||
BEFORE INSERT OR UPDATE OF canonical_product_id ON manual_fulfillment_configs
|
||||
BEFORE INSERT OR UPDATE ON manual_fulfillment_configs
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION assert_manual_config_product_source();
|
||||
|
||||
-- 已启用的配置仍可能指向后来被归档的人工商品。这里恢复其 man: 商品,
|
||||
-- 避免迁移后归一继续把后续订单挂到不可用商品上。
|
||||
UPDATE product_catalog product
|
||||
SET status = 'active',
|
||||
updated_at = NOW()
|
||||
FROM manual_fulfillment_configs config
|
||||
WHERE config.canonical_product_id = product.id
|
||||
AND config.enabled = TRUE
|
||||
AND product.canonical_sku LIKE 'man:%'
|
||||
AND product.status <> 'active';
|
||||
|
||||
-- 修正迁移 141 后由配置变化造成的存量陈旧影子记录。
|
||||
SELECT sync_fulfillment_shadow(item.id)
|
||||
FROM order_items item
|
||||
|
||||
@@ -41,6 +41,9 @@ test('人工履约配置不能关联其他来源商品', () => {
|
||||
assert.ok(configSyncMigration.includes('trg_manual_config_product_source'))
|
||||
assert.ok(configSyncMigration.includes("product.canonical_sku LIKE 'man:%'"))
|
||||
assert.ok(configSyncMigration.includes("ERRCODE = '23514'"))
|
||||
assert.ok(configSyncMigration.includes('BEFORE INSERT OR UPDATE ON manual_fulfillment_configs'))
|
||||
assert.ok(configSyncMigration.includes('config.enabled = TRUE'))
|
||||
assert.ok(configSyncMigration.includes("SET status = 'active'"))
|
||||
})
|
||||
|
||||
test('明确渠道即视为已路由,不用渠道配置缺失覆盖已选渠道', () => {
|
||||
|
||||
Reference in New Issue
Block a user