-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Future Dev
Ever since the customfields api was introduce way in 3.9 it should have been on the agenda to convert the user profile fields to use the case api and I can't seem to find another tracker which covers it.
The addition of report builder I think makes this more important to get done. The key driver here is the performance of reports when you filter on a user profile field, vs filtering on a customfield. The old user profile fields always store their data in a single generic text column and dynamically cast the type on the fly which means it can never be indexed correctly:
https://github.com/moodle/moodle/blob/master/lib/db/install.xml#L1409-L1411
The customfield api by comparison has 5 typed columns available and each plugin chooses which one to store in:
https://github.com/moodle/moodle/blob/master/lib/db/install.xml#L4322-L4326
I think there is room for improvement on the indexing but it can be indexed easily in future where the old way can't be. This is also ignoring all the other reasons which make the new api better.
To aid in the transition I think we should:
- do all the usual deprecation warnings
- add support for the new api side by side with the old api
- add some sort of way new api added to the legacy user profile field api so each plugin can declare a migration path to its equivalent customfield plugin
- provide a cli script which migrated the data from old to new, typically I think most admins would only want to do this when they can make a clean cut completely from old to new without having a mix
- eventually closer to final deprecation, during upgrade if the equivalent plugin exists and is installed then data is migrated.