LemonChannels. ModelPolicy. Migration
(lemon_channels v0.1.0)
View Source
Migration utilities for transitioning from legacy policy storage to ModelPolicy.
Supports migrating:
- Telegram default model preferences (
:telegram_default_model) - Telegram default thinking preferences (
:telegram_default_thinking)
Usage
# Migrate all Telegram policies
LemonChannels.ModelPolicy.Migration.migrate_telegram()
# Dry run to see what would be migrated
LemonChannels.ModelPolicy.Migration.migrate_telegram(dry_run: true)
# Check migration status
LemonChannels.ModelPolicy.Migration.status()
Summary
Functions
Migrates Telegram default model and thinking policies to the new ModelPolicy system.
Checks if there are any legacy Telegram policies that need migration.
Returns the migration status showing counts of legacy policies.
Types
@type result() :: %{ migrated: non_neg_integer(), skipped: non_neg_integer(), errors: non_neg_integer(), details: [map()] }
Migration result statistics
Functions
Migrates Telegram default model and thinking policies to the new ModelPolicy system.
Options
:dry_run- When true, only reports what would be migrated without making changes.:channel_id- The channel ID to use for the migration (default: "telegram")
Returns
A map with migration statistics:
:migrated- Number of policies successfully migrated:skipped- Number of policies already existing or empty:errors- Number of policies that failed to migrate:details- Detailed list of each migration operation
@spec needs_migration?() :: boolean()
Checks if there are any legacy Telegram policies that need migration.
@spec status() :: %{ telegram_models: non_neg_integer(), telegram_thinking: non_neg_integer(), model_policies: non_neg_integer() }
Returns the migration status showing counts of legacy policies.