Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
161 views
in Q2A Core by
I'm working on a script to migrate questions from my main Q2A install to the meta-site I set up. So far, I have these steps:
- Given question ID, find answers and comments, and comments on each answer.
- Insert the question into the other database, get the ID back.
- Insert the question's answers/comments with that ID as the parent.
- Insert the answer's comments, using each answer's ID as the parent.
- Delete all content from the main database.

Have I missed anything here? What is the setup with related questions, might that affect things?

1 Answer

0 votes
by
It's a good start but there are also 'best answer' selections (set in the selchlidid column of Qs in qa_posts) and votes (in the qa_uservotes table) to think about.

Related questions are calculated automatically based on the information in the database. So when you've finished the migration all you need to do is click all the 'Recalculate' buttons in the 'Stats' page of the 'Admin' panel on both sites.
by
Thanks for the tips. For related questions, I meant when you click "ask related question", I guess the new question is tied to the previous one somehow. (Although since I'm only moving one Q at a time I probably can't do this.)
by
'Ask related question' is also indicated through the parentid of the Q row, which will be the postid of the A row to which the question was related.
...