Created
November 9, 2011 13:02
-
-
Save brandon-beacher/1351355 to your computer and use it in GitHub Desktop.
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
maximum_id = 2 | |
[:customer_a, :customer_b].each_with_index do |database_name, index| | |
id_offset = index * maximum_id | |
ActiveRecord::Base.connection.execute %{ | |
insert into people | |
select | |
`id` + #{id_offset}, | |
`name`, | |
#{database_name} | |
from #{database_name}.people | |
%} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment