title: Ruby on Rails Migration - Create New Database Schema
body: <p>I have a migration that runs an SQL script to create a new Postgres schema. When creating a new database in Postgres by default it creates a schema called 'public', which is the main schema we use. The migration to create the new database schema seems to be working fine, however the problem occurs after the migration has run, when rails tries to update the 'schema_info' table that it relies on it says that it does not exist, as if it is looking for it in the new database schema and not the default 'public' schema where the table actually is.</p>
  
  <p>Does anybody know how I can tell rails to look at the 'public' schema for this table?</p>
  
  <p>Example of SQL being executed: ~</p>
  
  <pre><code>CREATE SCHEMA new_schema;
  COMMENT ON SCHEMA new_schema IS 'this is the new Postgres database schema to sit along side the "public" schema';
  -- various tables, triggers and functions created in new_schema
  </code></pre>
  
  <p>Error being thrown: ~</p>
  
  <pre><code>RuntimeError: ERROR C42P01  Mrelation "schema_info" does not exist
  L221    RRangeVarGetRelid: UPDATE schema_info SET version = ??
  </code></pre>
  
  <p>Thanks for your help</p>
  
  <p>Chris Knight</p>