linux user
2006-Aug-17 15:22 UTC
[Rails] Migrations for migrating data across databases - is it possible?
Hi All I am trying to understand if I can use migrations to migrate data under the following conditions 1. Across 2 different databases (Oracle/DB2) with same schemas. 2. Across 2 different databases (Oracle/DB2) with different schemas. I am trying to avoid writing DBI/OCI8 scripts. Can somone please shed some light if this is even possible? thanks -daya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/27824f66/attachment.html
Jodi Showers
2006-Aug-17 15:28 UTC
[Rails] Migrations for migrating data across databases - is it possible?
Hey Daya - You''ve got a couple of challenges - one is talking to multiple databases. This article will help you slay that dragon: http://programmerassist.com/article/302 You''ll note a reference to the ActiveRecord/Base documentation. Plus (in a previous email) I think you mentioned not being able to execute DDL? if so, tables (etc) will be created by your DBA, and your migration scripts will utter DML. Hopefully that moves your forward. cheers, Jodi On 17-Aug-06, at 11:22 AM, linux user wrote:> Hi All > > I am trying to understand if I can use migrations to migrate data > under the following conditions > > 1. Across 2 different databases (Oracle/DB2) with same schemas. > 2. Across 2 different databases (Oracle/DB2) with different schemas. > > I am trying to avoid writing DBI/OCI8 scripts. > > Can somone please shed some light if this is even possible? > > thanks > -daya > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
linux user
2006-Aug-17 15:35 UTC
[Rails] Migrations for migrating data across databases - is it possible?
Thanks Jodi I have been able to connect to multiple databases by specifying class specific connections. My questions a bit refined now are 1. what should I be doing in self.up and self.down, keeping in mind that I won''t have DDL access 2. should I be using one migration per table or can I use one migration for multiple tables? I agree that most my question stem from my lack of deep understanding about migrations. Regards -daya On 8/17/06, Jodi Showers <jodi@nnovation.ca> wrote:> > Hey Daya - > > You''ve got a couple of challenges - one is talking to multiple > databases. > > This article will help you slay that dragon: > http://programmerassist.com/article/302 > > You''ll note a reference to the ActiveRecord/Base documentation. > > Plus (in a previous email) I think you mentioned not being able to > execute DDL? if so, tables (etc) will be created by your DBA, and > your migration scripts will utter DML. > > Hopefully that moves your forward. > > cheers, > Jodi > > On 17-Aug-06, at 11:22 AM, linux user wrote: > > > Hi All > > > > I am trying to understand if I can use migrations to migrate data > > under the following conditions > > > > 1. Across 2 different databases (Oracle/DB2) with same schemas. > > 2. Across 2 different databases (Oracle/DB2) with different schemas. > > > > I am trying to avoid writing DBI/OCI8 scripts. > > > > Can somone please shed some light if this is even possible? > > > > thanks > > -daya > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/a6e15524/attachment.html
Jodi Showers
2006-Aug-17 15:59 UTC
[Rails] Migrations for migrating data across databases - is it possible?
Hey Daya,> 1. what should I be doing in self.up and self.down, keeping in mind > that I won''t have DDL accessSince you don''t have DDL access, then code your DML there. grin. This can take the place of raw sql, or as I like to code them using Model methods; ala: class SeedFoosBars < ActiveRecord::Migration class Foo < ActiveRecord::Base; has_many :bars end class Bar < ActiveRecord::Base; belongs_to :foo end def self.up # if you had DDL above then you''d need to # Foo.reset_column_information foo = Foo.create(:description => "Foo description") Bar.create(:description => "Bar description", :foo => foo) end def self.down # here you''d remove the seeded data above end> 2. should I be using one migration per table or can I use one > migration for multiple tables?This topic was recently discussed. I like to target migrations for functionality(multiple tables) - others per table. Whatever floats your boat! http://comments.gmane.org/gmane.comp.lang.ruby.rails/91032 Both AWDWR and the Recipes book will be of great value to you Daya [ as well as the list archive and google]. cheers, Jodi On 17-Aug-06, at 11:35 AM, linux user wrote:> Thanks Jodi > > I have been able to connect to multiple databases by specifying > class specific connections. > > My questions a bit refined now are > > 1. what should I be doing in self.up and self.down, keeping in mind > that I won''t have DDL access > 2. should I be using one migration per table or can I use one > migration for multiple tables? > > I agree that most my question stem from my lack of deep > understanding about migrations. > > Regards > -daya > > > On 8/17/06, Jodi Showers <jodi@nnovation.ca> wrote: > Hey Daya - > > You''ve got a couple of challenges - one is talking to multiple > databases. > > This article will help you slay that dragon: > http://programmerassist.com/article/302 > > You''ll note a reference to the ActiveRecord/Base documentation. > > Plus (in a previous email) I think you mentioned not being able to > execute DDL? if so, tables (etc) will be created by your DBA, and > your migration scripts will utter DML. > > Hopefully that moves your forward. > > cheers, > Jodi > > On 17-Aug-06, at 11:22 AM, linux user wrote: > > > Hi All > > > > I am trying to understand if I can use migrations to migrate data > > under the following conditions > > > > 1. Across 2 different databases (Oracle/DB2) with same schemas. > > 2. Across 2 different databases (Oracle/DB2) with different schemas. > > > > I am trying to avoid writing DBI/OCI8 scripts. > > > > Can somone please shed some light if this is even possible? > > > > thanks > > -daya > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/f72e6143/attachment-0001.html