?
Solved

migrate comments from an old Wordpress database to new DB with different post ID's

Posted on 2011-10-04
7
Medium Priority
?
234 Views
Last Modified: 2012-05-12
Simple description: How can I migrate post comments from an old WP site where the post ID's are different on the new site?

Long description:
We are migrating away from an old custom CMS. It uses a mySQL DB to hold its articles. Comments were an afterthought, and we simply added a link at the end of each article to a wordpress post that merely held comments.

The articles DB table has two useful fields: article name, and the post ID of the corresponding WP post of the comments.

We need to import the comments into the new fully wordpress-based site. All articles have been imported to posts. Those post ID's do not match up to the comment posts on the old WP site.

To locate comments to import, the old articles database must be searched for a post title from the new WP database. The old/new titles are only similar, but will usually match up. When a title is matched, the blog_link field will reference the post ID of the corresponding comment post. Then I can replace the comment_post_ID in each old comment with the new post ID and insert all those into the new site comment table.

There's my outline. Can anyone suggest any helpful tools? Maybe an application or PHP API/framework for sorting and processing through multiple databases?

0
Comment
Question by:SonicVoom
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:johanntagle
ID: 36913785
Suggest you make a table that maps the old and new post ids.  Dont think you can fully automate populating this because as you said, the titles are not exact matches.  But once you have this table, its easy to make a script, whether in a stored procedure or an external perl/ruby/whatever script, to copy the data over.
0
 
LVL 2

Author Comment

by:SonicVoom
ID: 36913814
Yes, that's a good starting place. But I'd like to try to automate it, as there are many.

How could I iterate through a db table, searching for the string from a field, in a field of another database?

I would need to manually check the results, so perhaps the search string and result could be placed in a table together.
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 36913936
Take a look at full text searching.  Create a full text index on the old title column and do lookups using keywords from the new titles.
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
LVL 2

Author Comment

by:SonicVoom
ID: 36934473
That is a good plan. I also need advice on tools for searching and manipulating this data. For example, applications or frameworks that assist in searching through several mysql databases.

I'm just now beginning to study SQL in this capacity.

Might the Wordpress database wrapper functions be able to address some of this?
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 36934826
Sorry, I don't use Wordpress so I cannot answer your last question.  For the first one, I think this is manageable using any of the popular languages available.  I would personally use Ruby and the Sequel gem (http://sequel.rubyforge.org/).  In the past I would have used Perl.
0
 
LVL 2

Accepted Solution

by:
SonicVoom earned 0 total points
ID: 37054563
I ended up choosing ezSQL. It's doing almost everything I need.
0
 
LVL 2

Author Closing Comment

by:SonicVoom
ID: 37081728
Thanks for the other suggestions.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question