21 lines
689 B
JavaScript
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.
|
|
};
|