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

  • Home
  • SEARCH
  • 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 227603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:36:44+00:00 2026-05-11T19:36:44+00:00

rake db:schema:dump This command gives you the schema of a legacy database and you

  • 0
rake db:schema:dump

This command gives you the schema of a legacy database and you can build a migration for that database off the generated schema.

But if that database had data in it, it would be nice if there was a rake command to retrieve the data in a migration file generated by Rails.

Perhaps I’m dreaming – it’s probably asking too much to think that Rails could look at the data in the legacy database and construct a migration for you from the existing data – something like this:

class LoadDefaultData < ActiveRecord::Migration
  def self.up
    bopeep = User.find_by_username 'bopeep'
    BlogPost.create(:title => 'test', :content => 'test', :author_id => bopeep.id, :status => 'ok')
  end

  def self.down
  end
end

Or is there a way?

  • 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-11T19:36:44+00:00Added an answer on May 11, 2026 at 7:36 pm

    Tobias Lütke needed to migrate a database from one architecture to another but needed to copy the data across intact. To ensure that the format would be architecture agnostic, he’s created a plugin that dumps the data to YAML and then reloads it back into the database at the other end. It’s a simple rake task, and Tobi gives quick and easy instructions.

    http://blog.leetsoft.com/2006/5/29/easy-migration-between-databases

    This may help.

    You may also like to look at YamlDB plugin http://opensource.heroku.com/ which can back up from one db type and restore to another. Here are some instructions

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

Sidebar

Related Questions

Im new with rails and Im trying to execute rake db:schema:dump, but Im having
rake db:schema:dump rake db:test:prepare All use the following generated schema.rb: t.column cost_per_license, :decimal, :limit
I executed the function: rake db:schema:dump and that's whats I got: C:\Users\Oded\sites\simple_cms>rake db:schema:dump (in
I ran rake db:migrate to re-sync schema.db with my database schema. But it failed,
When running rake db:schema:dump on an app that uses a postgres schema (i.e. schema_name.users),
The following rake command doesn't work rake db:schema:dump /Library/Ruby/Gems/1.8/gems/bundler-1.1.4/lib/bundler/runtime.rb:211: warning: Insecure world writable dir
Does rake db:schema:dump recreate schema.rb from migrations or the database itself?
I'm getting this error while doing rake:seed. can't mass-assign protected attributes I know that
I have a migration that's breaking in the middle of a couple of schema
I'm trying to deploy a Rails3 app to Heroku, but am getting this 'Rake

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.