How to add missing indices?

I know the core used the OCC command db:add-missing-indices to add indices for tables as this might take quite some time and timeout on regular HTTP requests.

When looking at app development, adding indices can obviously be done in a classical migration or a repair step. I do not know if one can as well hook somehow into the db:add-missing-indices invocation.

What is the suggested/recommended way to add indices for an app?

@rullzer has something ready for this: Add optional index API by rullzer 路 Pull Request #25471 路 nextcloud/server 路 GitHub

some testing and feedback is highly appreciated, then we can hopefully have this with Nextcloud 22+ :slight_smile: