APUSMS Posts Data Update Strategy

The last step is to grab the updated posts, per the fact that we grabbed a snapshot of the dbs some time ago, and most blogs have been updated since. Log into the db via phpMyAdmin, or mySqlWorkbench, and select the posts for 2017:

SELECT *
FROM wp_##_posts
WHERE post_date >= '2017-01-01' and post_date < '2017-04-26'; --today's date--

Next, at the bottom of the returned rows, check all and select Export:

This will give you .sql file of just this year's posts

Next, open up the exported .sql file in a text editor, and delete the "Create Table" statement, since we'll be importing the post data into the existing wp_##_posts table.

Then, we'll need to change the table name, like we did during the Content Migration strategy:

Update urls within posts and postmeta with the new wp-content/uploads path

UPDATE wp_##_posts SET post_content = REPLACE (
post_content,
'/wp-content/uploads/2',
'/wp-content/uploads/sites/##/2');

UPDATE wp_##_postmeta SET meta_value = REPLACE (
meta_value,
'/wp-content/uploads/2',
'/wp-content/uploads/sites/##/2');