project-nomad/admin/database
rcorvus c9bc7e20dc fix(db): allow 'dataset' in installed_resources.resource_type
The model declares `'zim' | 'map' | 'dataset'` and IngestDrugDataJob writes a
'dataset' row for the openFDA drug labels, but the column was still
enum('zim','map') from the table's original migration. Every write failed:

  Data truncated for column 'resource_type' at row 1
  insert into `installed_resources` (... `resource_type`, ...) values
  (..., 'openfda-drug-labels', 'dataset', ...)

The ingest itself succeeded — 261,671 rows landed in drug_labels — but the
install-state write-back at the end of the job was lost every time. Since
getCategoriesWithStatus() resolves a tier only when every resource id is
accounted for, and it already queries whereIn('resource_type', ['zim',
'dataset']), the missing row kept the Medicine category from ever resolving
its Standard or Comprehensive tier. Only the enum was left behind.

Verified against a live install: after the migration the previously failing
insert succeeds, and Medicine resolves installedTierSlug
'medicine-comprehensive'.

down() drops 'dataset' rows before narrowing the column, since MySQL would
otherwise truncate them to '' or fail under STRICT_TRANS_TABLES.
2026-08-13 20:06:17 -07:00
..
migrations fix(db): allow 'dataset' in installed_resources.resource_type 2026-08-13 20:06:17 -07:00
seeders fix(supply-depot): bump default Ollama and CyberChef image versions (#1036) 2026-06-23 04:47:12 +00:00