[Rails] Using migrations with legacy schema

linux user fanoflinux at gmail.com
Thu Sep 7 13:52:57 GMT 2006


Hi All

Please excuse me if my questions sound silly.

I have developed a rails app with an existing legacy schema and now with
changes in customer requirements, I need to change the schema. The legacy
(schema) database has > 250K.

What I would like to know is

1. Is it possible to migrate the data along with migrating the schema if use
Migrations? If it is possible can somebody point me to an example, because
in all the migrations tutorials that I see they have self.up (to create
tables) and self.down (to drop tables) but what about data?

2. If I use migrations I will have to change my model classes, how can I
minimize the pains of keeping my model classes in sync
with schema changes specially when I am using A) 'set_primary_key' etc.
B) rake migrate VERSION=xx

3. When I write my unit test for testing models, how do I keep my tests in
sync with rake migrate VERSION=xx? Can I migrate my fixtures along with
schema changes?

4. I will need a to keep my test: database in sync with migrations and I am
assuming that rake would take care of migrating the schema in test database
before running the tests. Is my assumption correct?

TIA

-daya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060907/eaf5db6e/attachment.html


More information about the Rails mailing list