Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:43:19+00:00 2026-05-28T01:43:19+00:00

If I am using DataMapper, and I have two databases, is there any way

  • 0

If I am using DataMapper, and I have two databases, is there any way using migration.rb to copy a table for example table person from database 1 to database 2? (same schema and table values).

Referring this:https://github.com/datamapper/dm-migrations/blob/master/examples/sample_migration.rb

It only tells me how to add/modify/drop tables.

Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:43:19+00:00Added an answer on May 28, 2026 at 1:43 am

    I don’t think that’s the intention of dm-migrations. I believe the easiest way would be something like this:

    DataMapper.setup(:default, db1_config)
    DataMapper.setup(:new, db2_config)
    class Foo
      include DataMapper::Resource
      property :id, Serial
      property :name, String
      ...
    end
    DataMapper.finalize
    
    Foo.each do |foo|
      DataMapper.repository(:new) do
        # It may not let you set the "id" attribute here...
        Foo.create(foo.attributes)
      end
    end
    

    Edit

    In hindsight, I’m not sure if you were asking how to to copy table structure as to opposed to table data. This is obviously copying table data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just using DataMapper for the first time. I have set up a table in
What's the most efficient way to iterate through an entire table using Datamapper? If
Using online interfaces to a version control system is a nice way to have
I have a problem with DataMapper (I'm using it with Sinatra) I have a
I have a padrino install that is using datamapper and logging queries to a
I'm using Datamapper 1.0 with sinatra and sqlite3 as backend. I have some devices,
Using Codeigniter and Datamapper : I have 2 tables: tags and clients . Clients
I am using the DataMapper ORM and I have the following tables: channel_providers ==================
I have these two database tables: locations id name users id location_id last_name first_name
I'm looking at using DataMapper ORM with CodeIgniter, but have a scenario where the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.