# `PhoenixKit.Migrations.Postgres.V41`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/phoenix_kit/migrations/postgres/v41.ex#L1)

PhoenixKit V41 Migration: AI Request Prompt Tracking & Reasoning Parameters

This migration adds:
1. Prompt tracking columns to AI requests table
2. Reasoning/thinking parameters to AI endpoints table

## Changes

### Modified Table: phoenix_kit_ai_requests
- Added prompt_id for linking requests to prompts
- Added prompt_name for denormalized history display (like endpoint_name)

### Modified Table: phoenix_kit_ai_endpoints
- Added reasoning_enabled (boolean) - Enable reasoning with default effort
- Added reasoning_effort (string) - none/minimal/low/medium/high/xhigh
- Added reasoning_max_tokens (integer) - Hard cap on thinking tokens (1024-32000)
- Added reasoning_exclude (boolean) - Hide reasoning from response

## Backward Compatibility

- Existing requests will have NULL prompt_id/prompt_name (not all requests use prompts)
- Foreign key uses ON DELETE SET NULL to preserve history when prompts are deleted
- Existing endpoints will have NULL reasoning values (reasoning disabled by default)

# `down`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/phoenix_kit/migrations/postgres/v41.ex#L113)

# `up`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/phoenix_kit/migrations/postgres/v41.ex#L30)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
