On 8 August 2011 05:03, Doctor Nefario <[email protected]> wrote:
> I started my project using sqlite, and now it's starting to struggle.
>
> How do I migrate all my data to PostgreSQL, I'm using the same models,
> but I have data that needs to be moved?

Model.copy is your friend.

DataMapper.setup(:default, postgres_repo)
DataMapper.setup(:old, sqlite_repo)

SomeModel.copy(:old, :default)
# etc.

You could also loop over DataMapper::Model.descendants.  Note that
after doing this you'll probably need to issue some raw sql commands
to reset the postgres sequences (for auto-increment PKs) to the new
starting values.

Regards
Jon

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to