Created
June 28, 2011 10:29
-
-
Save mrchrisadams/1050867 to your computer and use it in GitHub Desktop.
Rake example for making a migration script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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