Aswin Ramakrishnan
Aswin Ramakrishnan

Reputation: 3213

Rails: Copy data for specific tables between databases / environments

In a project I'm working on, I have certain tables that are used as lookup tables. They have a pretty complex structure and could be a bit long, so I went with database tables instead of YAML. Is there a way I can transfer those tables along with the data between different environments?

I have my development and test environment in heroku. So any heroku based ways to transfer data will be appreciated too.

Upvotes: 1

Views: 580

Answers (1)

Richard Peck
Richard Peck

Reputation: 76774

You may benefit from database seeding

--

A relatively simple procedure - you can pre-populate your datatables using the db/seeds.rb file:

#db/seeds.rb
Model.create({option: "value"})

You can then use rake db:seed to populate the datatables

--

Probably not what you're looking for exactly, but certainly an option

Upvotes: 1

Related Questions