medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
438 stars 207 forks source link

Update add-contact-id-to-user-docs migration to not use medic-client view #9290

Open dianabarsan opened 1 month ago

dianabarsan commented 1 month ago

What feature do you want to improve? We've been making efforts to remove calls to medic-client in api startup, but this call crept in in a recent update: https://github.com/medic/cht-core/blob/master/api/src/migrations/add-contact-id-to-user-docs.js#L6

Describe the improvement you'd like It would be super easy to change this to an _all_docs request with a start_key and end_key to get user-settings docs, which always follow a preset format of org.couchdb.user:<username>.

Additional context This is blocking a complicated and lengthy upgrade of a production instance, where we don't have the luxury to wait for medic-client indexing before launch.

dianabarsan commented 1 month ago

Related issue of same effort: https://github.com/medic/cht-core/issues/7964