Justus Eapen
Justus Eapen

Reputation: 1159

rake db:seed failing on pending migration when there are none

I'm running a (previously working fine) seed file like so: Seed failure trace

I check to see if there are pending migrations with rake db:migrate:status and all migrations are "up".

For additional context, here's what led me to this point:

  1. Working in 6 year old Rails Code
  2. Start a branch for feature "A"
  3. Wrap feature "A". Checkout new branch for Feature "B" Master --> "A" --> "B"
  4. Finish feature "B" + commit
  5. Checkout "A" for refactoring
  6. Add column to migration for "A" (nothings been merged with master yet, so I figure I can drop and rebuild my dev db no problem WRONG)
  7. Wrap refactoring for "A" + Commit
  8. Checkout Branch "B" 9 Merge "A" into "B"
  9. Drop DB
  10. Create DB with bin/rake db:create db:schema:load All good
  11. Run rake db:seed and nothing happens.
  12. Run with trace and get the error you see above.
  13. Have no idea what's causing this.

More Context

-Ruby 2.3.1 -Rails 4.2.7.1 -Postgresql 9.6.2

Upvotes: 2

Views: 959

Answers (1)

Robert Nubel
Robert Nubel

Reputation: 7522

It doesn't look like you actually have a problem; abort_if_pending_migrations just happens to be the last trace line that even a successful seed outputs. A fully-working Rails env on my machine spits out the same output, but works just fine (complete with 0 error code):

$ be rake db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
$ echo $?
0

For the record, it's expected for db:seed to normally print no output.

Upvotes: 2

Related Questions