Note that there are some explanatory texts on larger screens.

plurals
  1. POPGError: ERROR: relation "users" does not exist - Rails Tutorial 2nd Edition Chapter 9 Heroku
    primarykey
    data
    text
    <p>At end of Chapter 9 of Hartl's Rails Tutorial (2nd Edition) ran into an error when populating the db using a rake task. Ended up resolving it, but not sure what went wrong. In case anyone else hits this error, here's what I did. If anyone knows what went wrong, please comment --I'd love to know. Thanks!</p> <p>Ran these commands</p> <pre><code>$ git push heroku $ heroku run rake db:migrate $ heroku pg:reset SHARED_DATABASE --confirm &lt;name-heroku-gave-to-your-app&gt; $ heroku run rake db:populate </code></pre> <p>Then, got this error:</p> <pre><code>rake aborted! PGError: ERROR: relation "users" does not exist : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"users"'::regclass AND a.attnum &gt; 0 AND NOT a.attisdropped ORDER BY a.attnum Tasks: TOP =&gt; db:populate (See full trace by running task with --trace) </code></pre> <p>Couldn't figure out what was wrong. Then came across this post: <a href="https://stackoverflow.com/questions/5450930/heroku-postgres-error-pgerror-error-relation-organizations-does-not-exist">Heroku Postgres Error: PGError: ERROR: relation &quot;organizations&quot; does not exist (ActiveRecord::StatementInvalid)</a></p> <p>From that, I just ran these commands:</p> <pre><code>heroku run rake db:reset heroku run rake db:migrate heroku run rake db:populate </code></pre> <p>Now the app is working. Still not clear to me why I got that error when resetting SHARED_DATABASE ... If anyone knows, curious to find out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload