EngineYard deploy - Vanilla Database

58 views
Skip to first unread message

paulo

unread,
Sep 12, 2011, 5:06:00 AM9/12/11
to Ruby on Rails: Talk
Hi folks,

Just after a 'best-practise' recommendation here really, I am
deploying a series of applications to EY and for each one, need to
setup the database with some default settings / user account etc etc.

What is the best way to write a few initial rows to a vanilla
database? I've looked into using the deploy hooks on EY but it doesn't
seem to cover DB interaction. . .

I know I could create a standard backup file and restore this each
time but it feels like there should be a better way!

Thanks,

Paul

Dr Nic

unread,
Sep 12, 2011, 8:46:00 AM9/12/11
to rubyonra...@googlegroups.com
When you deploy you can specify a migration task. By default it is "rake db:migrate". For your new applications, try "rake db:migrate db:seed", where db:seed is the Rails 3 hook for setting up new database content.

Remember to change your migration field back to "rake db:migrate" after the first successful deploy, other wise you will re-seed again and again :)

paulo

unread,
Sep 12, 2011, 9:33:05 AM9/12/11
to Ruby on Rails: Talk
Great - just what I was looking for with the db:seed command - thanks


Paul

Kevin Bedell

unread,
Sep 12, 2011, 9:43:00 AM9/12/11
to rubyonra...@googlegroups.com
http://www.kbedell.com/2011/03/15/seed-data-versus-testing-data-and-custom-rake-tasks-for-ruby-on-rails/

Here's a blog post I wrote on this subject with some sample code. It
covers the difference between loading 'seed' data which is intended to
live as a permanent part of the production database (for example, role
names or state codes) and loading sample data just used for testing
*for example, fake test accounts).

Hopefully it'll help. There's some sample code in the post.

-Kevin

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

Dr Nic Williams

unread,
Sep 12, 2011, 10:34:04 AM9/12/11
to rubyonra...@googlegroups.com
Thanks Kevin.

However you wish to load data, the migration task can take a command and it's output is included in the deploy logs.

Nov

Reply all
Reply to author
Forward
0 new messages