Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter upgrading Postgres and Rails I cannot get my migrations back on track
    primarykey
    data
    text
    <p>I had a working setup using Rails 3.1 and Postgres 9.0 and just upgraded Rails to 3.2.1 and Postgres 9.1.2.</p> <p>Upgrading postgres meant migrating the data as the 2 versions datastores are incompatible. I didn't care much to migrate the data in my local db's as they are all used for development purposes anyway. So I'm trying to recreate my databases using Rails migrations (or w/ schema). However no matter what I try I cannot get the migrations to run.</p> <p>Using either </p> <pre><code>rake db:migrate </code></pre> <p>or</p> <pre><code>rake db:reset </code></pre> <p>Running this on with my Postgres 9.1.2 setup gives me:</p> <pre><code>spif: &gt; rake db:migrate rake aborted! PG::Error: ERROR: relation "users" does not exist LINE 4: WHERE a.attrelid = '"users"'::regclass ^ : 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:migrate =&gt; environment (See full trace by running task with --trace) </code></pre> <p>At first I though it might be that the pg gem doesn't support Rails 3.2.1 yet so tried with sqlite3 as well but that gives me the same users not found:</p> <pre><code>spif: &gt; rake db:reset rake aborted! Could not find table 'users' </code></pre> <p>So it looks like Rails expects a users table somewhere. </p> <ol> <li><p>I have no clue how to find out what code is actually calling this. When I run the migration commands with --trace it show's that is ActiveRecord internals doing it. Can this be a bug in ActiveRecord 3.2.1 (how would I go about finding that out?).</p></li> <li><p>I can connect to the pg db's fine using psql and my user setup in config/database.yml. Does rails expect some postgres tables that it can query about users?</p></li> <li><p>I have completely removed my db/migrate directory and the db/schema.rb in order to make sure there is not some strange internal dependency there but also to no avail.</p></li> </ol> <p>I'm sure I'm missing some simple concept - I haven't often tried to reset my db from scratch so I hope there is a simple explanation.</p> <p>Thanks, help very much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    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