hello to all I been working on this from past few days. .I am talking about separate migration for each one of the multiple database that a single rails application has connection with.I know that rails can work with multiple databases but what with migrations for e.g my main rails application has a connection to two databases 1> main_development 2> secondary_development Know suppose i have to create a new migration for my secondary database how do i do it thanks to everyone -- Posted via http://www.ruby-forum.com/.
Virendra Negi wrote:> my main rails application has a connection to two databases > 1> main_development > 2> secondary_development > > Know suppose i have to create a new migration for my secondary database > how do i do itI''ll trade you! This is how you do migrations. Change the declaration of all of your applicable migrations: class MyMigration < SecondaryDevelopmentMigration ... the remainder of your migration ... # Put this somewhere convenient: class SecondaryDevelopmentMigration < ActiveRecord::Migration def self.connection SecondaryDevelopment.connection end end Your turn! How do you handle test fixtures for your second database? -- Posted via http://www.ruby-forum.com/.
Adam Ms. wrote: [...]> Your turn! How do you handle test fixtures for your second database?Test fixtures are evil. Use factories instead (I''m fond of Machinist for this). Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Adam Ms. wrote:> Virendra Negi wrote: > >> my main rails application has a connection to two databases >> 1> main_development >> 2> secondary_development >> >> Know suppose i have to create a new migration for my secondary database >> how do i do it > > > I''ll trade you! This is how you do migrations. Change the declaration of > all of your applicable migrations: > > class MyMigration < SecondaryDevelopmentMigration > ... the remainder of your migration ... > > > # Put this somewhere convenient: > class SecondaryDevelopmentMigration < ActiveRecord::Migration > def self.connection > SecondaryDevelopment.connection > end > end > > Your turn! How do you handle test fixtures for your second database?Sorry i didn''t get that could you please explain me one more time with good e.g thank anyway -- Posted via http://www.ruby-forum.com/.