Hi @ajnyga
Ah, I think I am getting crazy from those migrations… – It is so difficult to keep track and figure out when what has to be fixed and how and…
THANKS A LOT for thinking with me!
So, I think: for the upgrade 3.1.1 I think that the lines https://github.com/pkp/ojs/blob/master/dbscripts/xml/upgrade/3.1.0_update.xml#L89-L90 would be necessary only if one is upgrading from an older OJS 3.0.x, because for those coming from OJS 2 this is already set correctly here https://github.com/pkp/ojs/blob/master/dbscripts/xml/upgrade/3.0.0_postupgrade_metrics.xml#L19.
That line was necessary earlier, when the 3.0.0_postupgrade_metrics.xml was wrong too.
But, however, I think this two SQLs do not last long, or?
And else, regarding your suggestion for having 3 smaller SQLs: I am not sure, I would need to try… The logic seems to be correct.
Would it be possible for you to test on your big data how long these 3 queries take?
Or maybe, after these lines https://github.com/pkp/ojs/blob/master/dbscripts/xml/upgrade/3.1.0_update.xml#L89-L90 are run, would it be possible to see how long these queries take:
SELECT m.assoc_id FROM metrics m, submission_file_settings sfs WHERE m.assoc_type = 531 AND sfs.setting_name = 'old-supp-id' AND sfs.setting_value = m.assoc_id
comparing to the:
UPDATE metrics m, submission_file_settings sfs SET m.assoc_id = sfs.file_id WHERE m.assoc_type = 531 AND sfs.setting_name = 'old-supp-id' AND sfs.setting_value = m.assoc_id
i.e. if maybe this huge/complicated UPDATE is making problems… ?
Hmmm…
Or would it be possible for you to give me those 3-4 DB tables (metrics, submission_file_settings, submission_supplementary_files and submission_artwork_files) from you so that I can test it?