Forum: Ruby on Rails how to maintain data while using 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.
Rohit M. (Guest)
on 2006-02-03 15:47
(Received via mailing list)
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
Mikkel B. (Guest)
on 2006-02-03 15:53
(Received via mailing list)
You can write all kinds of ruby code in a migration...So everything is
actually possible...
Siva J. (Guest)
on 2006-02-04 17:27
(Received via mailing list)
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
Alex S. (Guest)
on 2006-02-05 22:40
(Received via mailing list)
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.
This topic is locked and can not be replied to.