discourse/plugins/discourse-ai/db
Keegan George 6fd7093cd9
FIX: migration issues with AI credits (#36089)
## 🔍 Overview
Deploys are failing on multisites where they had `LlmCreditAllocation`
with a `monthly_usage` value of zero because the migration was filtering
out those entries thus violating the `NOT NULL` constraint of the new
`daily_usage` column.

This update fixes the issue by wrapping the subquery in `COALESCE(...,
'{}'::jsonb)` to default to an empty JSON object when there are no
entries.

This will have no impact on sites that are already migrated because they
skip the migration via `column_exists?`, but it will fix sites that are
failing with the fixed SQL.
2025-11-18 16:42:21 -08:00
..
fixtures FEATURE: Lower summarization default access to trust level 1 (#35874) 2025-11-06 15:41:07 -03:00
migrate FIX: migration issues with AI credits (#36089) 2025-11-18 16:42:21 -08:00
post_migrate DEV: Apply credit system on daily schedule instead of monthly (#36066) 2025-11-18 09:38:28 -08:00