pediatric-ai-scribe-v3/migrations/1780000000000_drop-model-classification.js
Daniel e7599128ec
All checks were successful
Forgejo Android APK / Root app tests (push) Successful in 26s
Forgejo Android APK / Build signed APK (push) Successful in 1m58s
fix: separate Scribe/Clinical/Learning prompt sections; drop model classification entirely with scrub migration
2026-09-07 18:22:51 +02:00

21 lines
689 B
JavaScript

// Model classification (cost/tag/category) is discontinued: scrub stored custom
// model JSON and refuse re-adding those keys at the application layer.
exports.up = pgm => {
pgm.sql(`
UPDATE app_settings
SET value = (
SELECT jsonb_agg(jsonb_build_object('id', item->>'id', 'name', item->>'name'))::text
FROM jsonb_array_elements(value::jsonb) AS item
WHERE item ? 'id' AND item ? 'name'
)
WHERE key = 'models.custom'
AND value IS NOT NULL
AND value <> ''
AND value::jsonb IS NOT NULL
AND value::jsonb <> '[]'::jsonb;
`);
};
exports.down = pgm => {
// No historical classification data remains to restore; nothing to do.
};