Note to self
MySQL Search and Replace
0 responses
17 February, 2009 - 20:51
I've recently been moving a drupal site from one hosting environment to another, and the folder structure between the two within Drupal's sites/ is not identical. The main headache I was having was getting all nodes containing attached files and images to display properly. The Drupal image module is particularly unhelpful and unsympathetic about such moves.
A google search brought me to this page on urbanmainframe.com
update table_name set table_field = replace(table_field,'replace_that','with_this');
So to fix your file paths on a Drupal site that you're migrating that will ultimately live in a different directory within your sites folder,
UPDATE files SET filepath = replace( filepath, 'sites/all/files', 'sites/sitename.com/files' );