How to maintain data while using migration


#1

hi all
started using migration , gr8 stuff
but how can i maintain old data , or import it alongwith schema with
same easiness,
as in migration we only import schema ?
thanks
rohit


#2

You can write all kinds of ruby code in a migration…So everything is
actually possible…


#3

rohit mehra <rohitm2010@…> writes:

hi all started using migration , gr8 stuff but how can i maintain old data
, or import it alongwith schema with same easiness, as in migration we
only
import schema ? thanks rohit

Well, I don’t pretend to stay database agnostic in my migrations so I
use strictly execute() calls to run whatever sql I want. For example,
you could create a temp table, copy the data into it, and copy it back.
In postgres, temp tables are automatically dropped at the end of the
transaction.

As another said, you can also use whatever ruby code you what instead
of using SQL.


#4

When using migration, you probably will be using Alter , add_columns etc
to
ur old table. That should not affect the data that are already there


Rgds,
–Siva J.
http://www.varcasa.com/
My First Rails Project.
Education Through Collabration