ultisuite-backend/migrations/000053_ai_quota_defaults_pme.down.sql
R3D347HR4Y 3978622050
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
refactor(ai): update AI gateway and cost management features
- Refactored AI gateway to utilize new cost management structures for usage tracking.
- Replaced deprecated token extraction methods with a unified cost parsing approach.
- Enhanced usage fallback mechanisms and introduced detailed usage metrics in responses.
- Added new metering functionality to record AI usage and costs effectively.
- Updated tests to reflect changes in usage parsing and cost calculations.
- Introduced new API endpoints for retrieving AI usage summaries and pricing information.
2026-06-16 10:46:33 +02:00

43 lines
1.4 KiB
SQL

UPDATE ai_cost_policies
SET daily_limit_micro_eur = 10000000,
monthly_limit_micro_eur = 100000000,
updated_at = NOW()
WHERE scope_type = 'org'
AND daily_limit_micro_eur = 2000000
AND monthly_limit_micro_eur = 35000000;
UPDATE org_settings
SET settings = jsonb_set(
jsonb_set(
jsonb_set(
jsonb_set(
jsonb_set(
jsonb_set(
jsonb_set(
COALESCE(settings, '{}'::jsonb),
'{usage_quotas,llm_daily_cost_limit_eur}',
'10'::jsonb
),
'{usage_quotas,llm_monthly_cost_limit_eur}',
'100'::jsonb
),
'{usage_quotas,llm_requests_per_day}',
'100'::jsonb
),
'{usage_quotas,llm_tokens_per_month}',
'500000'::jsonb
),
'{usage_quotas,search_requests_per_day}',
'50'::jsonb
),
'{usage_quotas,max_api_tokens_per_user}',
'10'::jsonb
),
'{usage_quotas,max_webhooks_per_user}',
'20'::jsonb
),
updated_at = NOW()
WHERE id = 1
AND COALESCE((settings->'usage_quotas'->>'llm_daily_cost_limit_eur')::numeric, 0) = 2
AND COALESCE((settings->'usage_quotas'->>'llm_monthly_cost_limit_eur')::numeric, 0) = 35;