Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To drop the database, if you are using <code>SHARED_DATABASE_URL</code>:</p> <pre><code>$ heroku pg:reset DATABASE_URL </code></pre> <p>Now to <strong>recreate</strong> the database with nothing in it:</p> <pre><code>$ heroku run rake db:migrate </code></pre> <p>To <strong>populate</strong> the database with your seed data:</p> <pre><code>$ heroku run rake db:seed </code></pre> <p>---OR---</p> <p>You can combine the last two (<strong>migrate &amp; seed</strong>) into one action by executing this:</p> <pre><code>$ heroku run rake db:setup </code></pre> <p><strong>Edit</strong> 2014-04-18: <code>rake db:setup</code> doesn't work with Rails 4, it fails with a <code>Couldn't create database error</code>.</p> <p><strong>Edit</strong> 2014-10-09: You can use <code>rake db:setup</code> with Rails 4. It does give you a <code>Couldn't create database</code> error (because the database was already created using the <code>heroku pg:reset</code> command). But it also loads your database schema and your seeds after the error message.</p> <p>You can do this with pretty much any rake command, but there are exceptions. For example, <code>db:reset</code> doesn't work via <code>heroku run rake</code>. You have to use <code>pg:reset</code> instead.</p> <p>More information can be found in Heroku's documentation:</p> <p><a href="https://devcenter.heroku.com/articles/rake" rel="noreferrer" title="Heroku | Running rake commands">Running Rake Commands</a></p> <p><a href="https://devcenter.heroku.com/articles/heroku-postgresql#pg-reset" rel="noreferrer" title="Heroku | Reset Postgres DB">Reset Postgres DB</a></p>
 

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