PhoenixKit.Migrations.Postgres.V32 (phoenix_kit v1.7.33)

Copy Markdown View Source

PhoenixKit V32 Migration: AI System

This migration introduces the AI provider account management and usage tracking system.

Changes

AI Accounts Table (phoenix_kit_ai_accounts)

  • Store AI provider credentials (OpenRouter, etc.)
  • Support multiple accounts per provider
  • Optional settings for provider-specific configuration
  • API key validation tracking

AI Requests Table (phoenix_kit_ai_requests)

  • Track every AI API request for history and statistics
  • Token usage tracking (input, output, total)
  • Cost tracking when available
  • Latency and status monitoring
  • Per-user and per-account tracking

Settings Seeds

  • AI module enable/disable
  • Text processing slots configuration (JSON)

PostgreSQL Support

  • Leverages PostgreSQL's native JSONB for flexible metadata
  • Supports prefix for schema isolation
  • Optimized indexes for common queries

Summary

Functions

Rollback the V32 migration.

Run the V32 migration to add the AI system.

Functions

down(opts)

Rollback the V32 migration.

up(opts)

Run the V32 migration to add the AI system.