{"action":"created","issue":{"url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/91","labels_url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/91/comments","events_url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/91/events","html_url":"https://github.com/ndunand/moodle-tool_mergeusers/issues/91","id":58925461,"number":91,"title":"Auto detection of compound indexes","user":{"login":"jpahullo","id":2048296,"avatar_url":"https://avatars.githubusercontent.com/u/2048296?v=3","gravatar_id":"","url":"https://api.github.com/users/jpahullo","html_url":"https://github.com/jpahullo","followers_url":"https://api.github.com/users/jpahullo/followers","following_url":"https://api.github.com/users/jpahullo/following{/other_user}","gists_url":"https://api.github.com/users/jpahullo/gists{/gist_id}","starred_url":"https://api.github.com/users/jpahullo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpahullo/subscriptions","organizations_url":"https://api.github.com/users/jpahullo/orgs","repos_url":"https://api.github.com/users/jpahullo/repos","events_url":"https://api.github.com/users/jpahullo/events{/privacy}","received_events_url":"https://api.github.com/users/jpahullo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-02-25T16:15:03Z","updated_at":"2015-05-01T09:25:39Z","closed_at":null,"body":"Hi all!\r\n\r\nThe final solution for the compound indexes is to auto detect ALL compound indexes on every single Moodle instance, and considering also customizes indexes, even additional to those specified from Moodle.\r\n\r\nThe first step is to get all compound indexes. I get this SQL to get ALL compound indexes (i.e., indexes with more than a column).\r\n\r\nTo do so, we have `$DB->get_tables(false);` and then `$DB->get_indexes($table_name);` to get all indexes from the current Moodle instance, independent from the database engine :smiley: \r\n\r\nOnce I have all compound indexes, they will be filtered to consider only those with user-related column names.\r\n\r\nThe idea is to have a manual update (like an additional option to the administration settings), so that the compound indexes list is updated only on demand. \r\n\r\nAny suggestions are welcome!\r\n\r\nJordi"},"comment":{"url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/comments/98084697","html_url":"https://github.com/ndunand/moodle-tool_mergeusers/issues/91#issuecomment-98084697","issue_url":"https://api.github.com/repos/ndunand/moodle-tool_mergeusers/issues/91","id":98084697,"user":{"login":"ndunand","id":762972,"avatar_url":"https://avatars.githubusercontent.com/u/762972?v=3","gravatar_id":"","url":"https://api.github.com/users/ndunand","html_url":"https://github.com/ndunand","followers_url":"https://api.github.com/users/ndunand/followers","following_url":"https://api.github.com/users/ndunand/following{/other_user}","gists_url":"https://api.github.com/users/ndunand/gists{/gist_id}","starred_url":"https://api.github.com/users/ndunand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndunand/subscriptions","organizations_url":"https://api.github.com/users/ndunand/orgs","repos_url":"https://api.github.com/users/ndunand/repos","events_url":"https://api.github.com/users/ndunand/events{/privacy}","received_events_url":"https://api.github.com/users/ndunand/received_events","type":"User","site_admin":false},"created_at":"2015-05-01T09:25:39Z","updated_at":"2015-05-01T09:25:39Z","body":"Hi Jordi,\r\n\r\nI haven't forgotten about you, but haven't had time to look into this yet... sorry. I'll make sure to get back to you next week."}}