I am trying to understand if I can use migrations to migrate data under
- Across 2 different databases (Oracle/DB2) with same schemas.
- 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?
Hey Daya -
You’ve got a couple of challenges - one is talking to multiple
This article will help you slay that dragon:
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.
I have been able to connect to multiple databases by specifying class
My questions a bit refined now are
- what should I be doing in self.up and self.down, keeping in mind that
won’t have DDL access
- should I be using one migration per table or can I use one migration
I agree that most my question stem from my lack of deep understanding
- what should I be doing in self.up and self.down, keeping in mind
that I won’t have DDL access
Since 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;
class Bar < ActiveRecord::Base;
if you had DDL above then you’d need to
foo = Foo.create(:description => “Foo description”)
Bar.create(:description => “Bar description”, :foo => foo)
# here you’d remove the seeded data above
- 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
Both AWDWR and the Recipes book will be of great value to you Daya
[ as well as the list archive and google].