Is it better to do db:setup + db:seed or db:migrate for a fresh
install?  By my understanding, the seed data is not applied during a
db:migrate.  (This is not an application I have developed, and I am
not a Ruby/Rails developer, so please excuse my ignorance!)


On May 5, 8:55 am, Bryan Crossland <[email protected]> wrote:
> On Thu, May 5, 2011 at 6:45 AM, jcwoods <[email protected]> wrote:
> > I am in the process of packaging a rails application as an RPM, and I
> > have a few questions regarding the initialization of the database
> > environment.
>
> > As part of the post-install script, I need to check to see if the
> > database exists.  Depending on the outcome, I may have to run various
> > combinations of db:setup, db:migrate, and/or db:seed.  Is there a rake
> > (or some other) task I can run to check for the existence of the
> > "production" database?  If not, is there a "standard" way to fetch the
> > database name for the production environment from the database.yml
> > file so I can use external tools?
>
> > What I'm thinking about doing is defining the default user, password,
> > and database name as macros/constants in my .spec file.  When I build
> > my RPM, I will use sed to generate database.yml with these pre-defined
> > values so they are consistent between my initialization scripts (in
> > the spec file) and the database configuration included in the
> > package.  This would work perfectly with a new installation.
>
> > The problem with this approach is with upgrading an existing
> > installation.  Since database.yml is a configuration file, I have to
> > assume that the database.yml file has been modified and that my
> > "defaults" no longer match the production values.  I need a simple way
> > to ask rails "does my production database exist?".
>
> If you're rails environment variable is set to production
> (RAILS_ENV=production) then you can run db:create followed by db:migrate. If
> the db already exists then db:create will do nothing. If the migration is up
> to date then db:migrate will do nothing.
>
> B.
>
>
>
>
>
>
>
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to