Rails - Migration error - PG::InvalidSchemaName: ERROR:
<p>When I run <code>rake db:migrate</code> I get the following error:</p>

<pre><code>ActiveRecord::StatementInvalid: PG::InvalidSchemaName: ERROR:  no schema has been selected to create in
: CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 

PG::InvalidSchemaName: ERROR:  no schema has been selected to create in

Tasks: TOP =&gt; db:migrate
(See full trace by running
ActiveRecord::StatementInvalid: PG::InvalidSchemaName: ERROR:  no schema has been selected to create in
: CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 

PG::InvalidSchemaName: ERROR:  no schema has been selected to create in

Tasks: TOP =&gt; db:migrate
(See full trace by running task with --trace) task with --trace)
</code></pre>

<p>I have no idea how to fix it and would welcome any ideas.</p>

<p>I am running rails 4.</p>

<p>This error came about because I was originally using a MySQL database (worked fine), but then switched to pgSQL to allow for easy uploading to heroku. and now it's neither working on the local host nor on heroku.</p>