Related to #9008
DataMigrationForRubricQuestionsWithWeightsAttached.java in the current master branch should be run in order to do the migration.
@xpdavid @damithc I guess there is a major bug in the migration script
I was running the script to migrate the data in my dev server. First I ran the script in preview mode. and the output was:
--- Starting remote operation ---
Going to connect to:localhost:8080
Running teammates.client.scripts.DataMigrationForRubricQuestionsWithWeightsAttached...
Preview: true
Total number of keys: 25
Number of affected keys: 8
Number of updated keys: 0
--- Remote operation completed ---
Then when I ran the script again but this time not in preview mode and I got the output I was expecting.
--- Starting remote operation ---
Going to connect to:localhost:8080
Running teammates.client.scripts.DataMigrationForRubricQuestionsWithWeightsAttached...
Preview: false
Total number of keys: 25
Number of affected keys: 8
Number of updated keys: 8
--- Remote operation completed ---
But the weird thing happened when I ran the script again in preview mode expecting the numberOfAffectedKeys will be 0, as all data has been migrated, but the output was this
--- Starting remote operation ---
Going to connect to:localhost:8080
Running teammates.client.scripts.DataMigrationForRubricQuestionsWithWeightsAttached...
Preview: true
Total number of keys: 33
Number of affected keys: 8
Number of updated keys: 0
--- Remote operation completed ---
Total number of keys increased by 8. I am not sure why this is happening. I guess there is a fault in the script that is creating new entities where it should update the existing ones?
Confirmed, please don't run the script right now :( @damithc
It turns out we should use new FeedbackResponsesDb().updateFeedbackResponseOptimized()
Sorry for not picking up this during review time :(
Checked and run against my own staging server. Looks fine.
Ready to be run @damithc
Ran the script. Output:
Total number of keys: 12717
Number of affected keys: 1082
Number of updated keys: 1082
Most helpful comment
Ran the script. Output:
Total number of keys: 12717
Number of affected keys: 1082
Number of updated keys: 1082