| 1 | import type { createClient } from '@libsql/client' |
| 2 | |
| 3 | type LibSqlClient = ReturnType<typeof createClient> |
| 4 | |
| 5 | /** |
| 6 | * Patch: add disable_temperature column to model_configs table. |
| 7 | * Default 0 (temperature is sent). When 1, temperature param is omitted. |
| 8 | */ |
| 9 | export const patchModelConfigDisableTemperature = async (client: LibSqlClient): Promise<void> => { |
| 10 | const cols = await client.execute("PRAGMA table_info('model_configs')") |
| 11 | const hasColumn = cols.rows.some((r) => r.name === 'disable_temperature') |
| 12 | if (hasColumn) return |
| 13 | |
| 14 | await client.execute( |
| 15 | "ALTER TABLE model_configs ADD COLUMN disable_temperature INTEGER NOT NULL DEFAULT 0" |
| 16 | ) |
| 17 | } |
| 18 |