Forum: Ruby on Rails move data with migration

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tarscher (Guest)
on 2008-12-17 12:00
(Received via mailing list)
Hi all,

I have to change my database structure for a new release.

I can change the database structure with migrations but I also want to
move the data from the old structure  to the new structure. Is this
best done via a migration (if possible)?

Thanks
Stijn
Ar C. (Guest)
on 2008-12-17 16:19
A migration is probably the best way to approach this; you'll be moving
your data programmatically as well as creating the new structure. If
possible, your 'down' method could put it all back the way it was as
well.

I did this recently, and following the create for the new tables, there
were a series of data steps within the migration to move data from the
old structure to the new. I cloned my live data to my dev envt to make
sure I handled all the existing cases. Then test, test, test.
This topic is locked and can not be replied to.