Creating a development db from existing db

Hi there,

I would like to copy the schema and data from an existing database and
create a development db with the schema and data.

Is this possible? - I have heard of doing a ‘schema dump’, what about a
data dump. The data in the existing db is important - I worry that doing
something could delete the data. Is this fear unfounded?

Chris.

Chris F. wrote:

Is this possible? - I have heard of doing a ‘schema dump’, what about a
data dump. The data in the existing db is important - I worry that doing
something could delete the data. Is this fear unfounded?

What we’ve done here is use a plugin called ar_fixtures which allows you
to dump the data corresponding to a model. So we’ve taken a copy of the
production data from the legacy app, renamed the tables and fields in
SQL to correspond with our model, and then use “rake db:fixtures:dump
MODEL=Product” to create a fixture for that model. This is then simple
to reload (after a migration/recreation) through “rake
db:fixtures:load”.

d

Is the development db going to be on a different system than the
existing db? If so, you could just backup your existing db and then
restore it as a new db on your development system.

If you’re using MySQL, backups and restores can be performed with
MySQL Administrator.

Hope this helps.

Dan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs