Migrating data from one database to another

A previous developer had a built a website that includes literally thousands of news & events items. The problem is that he had created the database to work with his own CMS. We are now using WordPress so want to migrate this data into the WP database.

The problem is that the data is slightly different and will need some manipulating before it can be imported. Does anyone have a suggestions of an easy way to do this?

Read More

I need the old data from the original database to be in the format of the new WordPress database. Please bear in mind that there are literally hundreds of entries so it’s not a copy and paste job!

I’ve exported the examples as XML (CSV when exported was all over the place):

This makes up an event in the original custom CMS:

  <database name="medicom_medi">
    <!-- Table myevents -->
    <table name="myevents">
      <column name="id">13</column>
      <column name="title">This is the title</column>
      <column name="description">This is the content</column>
      <column name="mediwales_event">0</column>
    </table>
  </database>
  <database name="medicom_medi">
    <!-- Table myevents_dates -->
    <table name="myevents_dates">
      <column name="id">22</column>
      <column name="eventid">13</column>
      <column name="datefrom">2011-01-31 00:00:00</column>
      <column name="dateto">0000-00-00 00:00:00</column>
      <column name="venue">PA Consulting Group</column>
      <column name="address">123 Buckingham Palace Rd, London SW1W 9SR</column>
    </table>
  </database>

This is the format I need the data to be in inside WordPress:

<database name="medicom_v3">
    <!-- Table wp_posts -->
    <table name="wp_posts">
        <column name="ID">3871</column>
        <column name="post_author">1</column>
        <column name="post_date">2012-04-10 10:00:34</column>
        <column name="post_date_gmt">2012-04-10 10:00:34</column>
        <column name="post_content">Testing</column>
        <column name="post_title">Test event 2</column>
        <column name="post_excerpt"></column>
        <column name="post_status">publish</column>
        <column name="comment_status">closed</column>
        <column name="ping_status">closed</column>
        <column name="post_password"></column>
        <column name="post_name">test-event-2</column>
        <column name="to_ping"></column>
        <column name="pinged"></column>
        <column name="post_modified">2012-04-10 10:00:34</column>
        <column name="post_modified_gmt">2012-04-10 10:00:34</column>
        <column name="post_content_filtered"></column>
        <column name="post_parent">0</column>
        <column name="guid">http://www.mediwales.com/v3/?post_type=tribe_events&amp;#038;p=3871</column>
        <column name="menu_order">0</column>
        <column name="post_type">tribe_events</column>
        <column name="post_mime_type"></column>
        <column name="comment_count">0</column>
    </table>
</database>
<database name="medicom_v3">
    <!-- Table wp_postmeta -->
    <table name="wp_postmeta">
        <column name="meta_id">14580</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventShowMapLink</column>
        <column name="meta_value">false</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14581</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventShowMap</column>
        <column name="meta_value">false</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14582</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventAllDay</column>
        <column name="meta_value">yes</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14583</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventStartDate</column>
        <column name="meta_value">2012-04-17 00:00:00</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14584</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventEndDate</column>
        <column name="meta_value">2012-04-17 23:59:59</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14585</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventVenueID</column>
        <column name="meta_value">0</column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14586</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventCost</column>
        <column name="meta_value"></column>
    </table>
    <table name="wp_postmeta">
        <column name="meta_id">14587</column>
        <column name="post_id">3871</column>
        <column name="meta_key">_EventOrganizerID</column>
        <column name="meta_value">0</column>
    </table>
</database>

Related posts

Leave a Reply

1 comment

  1. Since it was a home-made CMS, you most likely won’t find any tool to translate all that code into WordPress format.

    I would make your a script (php or whatever) that will convert this huge dump.
    I think WordPress (or plugins) can read XML so you just have to adapt the structure and keys.