将五秒基础价按 duration / 5 比例结算,保留 provider 返回的小数时长,避免六秒视频被按两个完整单位收费。 影响:所有使用 5s 视频基础价的模型,quantity 与 durationUnitCount 允许小数。新增迁移同步现存规则的旧 ceil 公式元数据。 验证:go vet ./...;pnpm lint;pnpm test;pnpm build;./tests/ci/migrations-test.sh
15 lines
411 B
SQL
15 lines
411 B
SQL
UPDATE model_pricing_rules
|
|
SET formula_config = jsonb_set(
|
|
COALESCE(formula_config, '{}'::jsonb),
|
|
'{formula}',
|
|
to_jsonb(replace(
|
|
formula_config->>'formula',
|
|
'ceil(duration_seconds / 5)',
|
|
'(duration_seconds / 5)'
|
|
)),
|
|
true
|
|
),
|
|
updated_at = now()
|
|
WHERE resource_type = 'video'
|
|
AND strpos(formula_config->>'formula', 'ceil(duration_seconds / 5)') > 0;
|