Using rails to migrate between databases


#1

Hey people,

I have the following question to present to you all. I need some basic
information about how to use rails to migrate the dataset of my project
between two types of database systems.

First, the live data now exists in MSSQL and also uses a very poorly
designed database scheme.

Next, the data needs to be migrated to MySQL, also using a completely
re-designed schema, where tables have transformed and sometimes even
dropped.

How (in very general lines) woudl I accomplish this using ruby on rails?
I’m not really looking for any detailed examples or anything, just a
place to start.

Thanks in advance,

danny


#2

Assuming your application is running in rails already, you can run
‘rake db_schema_dump’. This will create db/schema.rb, which you can
then modify before importing into your MySQL database by running ‘rake
db:migrate’. If you’re not already running Ruby on Rails, you could
always set up a new rails application and point it to your current
MSSQL database (instructions here:
http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer).

Good luck.

On Feb 19, 7:15 am, Daniel Owen van Dommelen <rails-mailing-


#3

Theron Parlin wrote:

Assuming your application is running in rails already, you can run
‘rake db_schema_dump’. This will create db/schema.rb, which you can
then modify before importing into your MySQL database by running ‘rake
db:migrate’. If you’re not already running Ruby on Rails, you could
always set up a new rails application and point it to your current
MSSQL database (instructions here:
http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer).

Good luck.

On Feb 19, 7:15 am, Daniel Owen van Dommelen <rails-mailing-

I do not think this is an option for me since I’m working with an
enormous database.

There was a hint I got from the person who’s managing this project and
it was somewhat in the line of using SQL queries to get the data into
the code and then using this data I have to create the models to support
the new database layout.

any thoughts on that?

Thanks!


#4

by the way, the old database scheme is not following the rails
conventions…


#5

Do schemas differ a lot structuraly? Are relations more or less
preserved structuraly at least?

– fxn


#6

Xavier N. wrote:

Do schemas differ a lot structuraly? Are relations more or less
preserved structuraly at least?

– fxn

no the schema are pretty much complete different, also relations have
been totally redesigned. The old schema has been done by a student who
created it as his internship project, but has really dropped the ball
back then. This is also one of the reasons I had to complete redo the
database, about a year later now.

I might have found my information though. I’m diving into DBI module,
and it thusfar is proving to be the thing I was looking for… If anyone
is interested follow this link:

http://www.kitebird.com/articles/ruby-dbi.html

thanks for the attention people!


#7

Daniel,

You might be able to use ActiveWarehouse ETL to extract from the old
system, transform the data as necessary and load into the new system -
that’s what it was designed for (although primarily for data
warehouses but there is nothing that locks it into that).

More info: http://activewarehouse.rubyforge.org/etl

V/r
Anthony

On 2/19/07, Daniel Owen van Dommelen removed_email_address@domain.invalid
wrote:

back then. This is also one of the reasons I had to complete redo the


Posted via http://www.ruby-forum.com/.


Cell: 808 782-5046
Current Location: Melbourne, FL