I've inherited a project, which because of a weird quirk of WP's tumblr importer, has got a lot of posts whose IDs are > 2147483647, and are not causing grief on the new host that I'm migrating to. Their 32-bit architecture won't play nice with those big integers.
To that end, I've been trying to adapt the query I found over here,
SET @count = 0;
UPDATE `users` SET `users`.`id` = @count:= @count + 1;
to something more like:
SET @count = 0;
UPDATE wp_posts
left join wp_postmeta on wp_postmeta.post_id = wp_posts.id
SET wp_postmeta.post_id = @count = wp_posts.id = @count, @count := @count + 1;
Presumably, once I had that logic down, I could expand it to also join and update the wp_comments.comment_post_ID
field, among others.
But, alas it throws a syntax error. Is there any way to update all those ids to the same @count variable, and keep it incrementing with every row?