0

I need to "migrate" all quiz results from one website to a new one. The quiz ID is different between sites, and therefore, copying over the table from mysql won't work. However, I've made sure that user IDs are the same.

The new website isn't launched yet and there is a lot of flexibility for how I need to set things up in order to migrate in the most ideal way.

Edit: Alternatively, is there any reason I shouldn't just migrate the quizzes with the same node ID?

Edit2: I am using quiz version 7.x-5.1 on the new site but if they have to be the same, I'll have to rebuild the training feature with the version on the old site, which is 7.x-5.0-alpha4+77-dev. We have about 25 quizzes with 10-30 questions each.

7
  • The Quiz module typically runs not only on Node ID but also the version ID. So you'd have to make sure that both are the same... it'd be much better and easier if you can change the NID/VID in your new site to match the old one, especially if you're dealing with only one quiz. Commented Jun 30, 2017 at 15:04
  • Will changing the NID and VID to match the old site cause any issues? They are off by at least 3 digits (i.e. 2479 vs. 282638).
    – Christia
    Commented Jun 30, 2017 at 17:00
  • This scenario is far from idea any way you look at it :( What content lives on your new site's NID2479 and the corresponding VID? Also, did you make any revisions to the quiz (iow are there multiple VIDs?) Commented Jun 30, 2017 at 17:46
  • NID2479 is from the new site. The old site has larger NIDs and VIDs. I just want to know the cleanest, most ideal way to do this, regardless of my set up. I can change my set up to make it more idea, I just don't know what that is. Thanks!
    – Christia
    Commented Jun 30, 2017 at 17:54
  • Thanks for clarifying. I'm not aware of any other way to migrate quizzes and quiz results data other than copying the tables over. And every quiz response (quiz_node_results table) references the quiz NID and VID so in the new site the NIDs and VIDs will have to be the same for your quizzes to work. Commented Jun 30, 2017 at 19:22

1 Answer 1

0

This isn't the "Drupal way" to do this, but I accomplished a successful quiz results migration by making a few compromises and doing things in an unorthodox way. If anyone can build upon this and add a new answer with the correct way accomplish, I would be delighted!

The compromise I made was not allowing users to view their old results, just their score. I also decided not to use the certificate and created a view page instead for individual scores to make a certificate that way. (See this SE Post for my issues with Certificate.) This killed 2 birds with 1 stone.

Steps I followed for a successful migration trial on the test website:

  1. Add quiz_node_results table to new database:

mysql> insert into drupal.quiz_node_results (result_id, nid, vid, uid, time_start, time_end, released, score, is_invalid, is_evaluated, time_left) select result_id, nid, vid, uid, time_start, time_end, released, score, is_invalid, is_evaluated, time_left from drupal_web.quiz_node_results;

  1. Replaced NID of quiz results with new quiz nid, run once for each quiz (there were 18 quiz nodes):

mysql> update quiz_node_results set nid = replace (nid, [old quiz node ID], [new quiz ID]);

  1. Removed "view quiz results" from Gradebook view (custom view I built for showing results).

Please comment with foreseeable issues with this method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.