Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created June 28, 2011 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrchrisadams/1050867 to your computer and use it in GitHub Desktop.
Save mrchrisadams/1050867 to your computer and use it in GitHub Desktop.
Rake example for making a migration script
$ rake "mysql_migration[old.domain.com, new.domain.com]"
REPLACE ME WITH SQL STATEMENTS for old.domain.com AND new.domain.com
LIKE THIS
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
task :mysql_migration, :arg1, :arg2 do |t, args|
puts "REPLACE ME WITH SQL STATEMENTS for #{args[:arg1]} AND #{args[:arg2]}"
puts "LIKE THIS "
puts "UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment