open-city / recycling

Crowdsourcing data about which residential buildings do not have recycling in Chicago
MIT License
27 stars 24 forks source link

Original data migration fails #173

Closed rudyrigot closed 8 years ago

rudyrigot commented 8 years ago

This issue assumes that npm migrate:all is the proper way to get the schema up-to-date. If that's the case, then it doesn't work any more for fresh installs.

Running "migrate:all" task
>> Running migration `20141105023457939_add_date_to_reports`
>> Running migration `20141105030308575_add_comments`
Fatal error: Cannot read property 'ALDERMAN' of undefined

The failure is in 20150130233457984_add_ward_info.js, which tries to access the metadata.ALDERMAN field in the /migrations/data/wards/wardX.json files. The cause: when this migration was checked in, that was fine, because there was indeed a metadata field in them (688e8b4fe92f1ae7e1a9ad3521260864eb6ab9d9) but it seems to have been removed since from the JSON files, hence the failures now.

I'm not overly familiar with this migration tool; I know that Rails's Active Record solves that issue by storing the schema in a file, and having the DB schema be built from that file, instead of playing past migrations. Am I doing it wrong, and this migration tool has such a feature? I wasn't able to find a schema file, and the doc of the grunt plugin doesn't seem to mention it.

If I'm doing it wrong, please advise on what's the right way, and I'll open a PR to fix the doc; if I'm doing it right, then I'll open a PR to fix the broken migration. Please advise!

(Until then, my local environment is stuck, so I guess that's all for today!)

rudyrigot commented 8 years ago

I assumed doing it right (couldn't find another imported package that would do it differently, and grunt-mongo-migrations definitely doesn't offer another way), so I fixed the failing past migrations in the #174 PR. Closing.