title: What is the best way to drop a table & remove a model in Rails 3?
body: <p>I have a model &amp; a table which I no longer need in my App, I could leave them there but I would like to remove them to keep things tidy.</p>
  <p>I'm trying to figure out the best way to remove them with out messing around with my <em>migrations</em> &amp; <em>db/schema.rb</em> files &amp; any side effect it could have on my production environment, my app is on Heroku.  I'm using PostgreSQL on both my local machine &amp; heroku.</p>
  <p>So far I've found two ways to do this but am not sure which is the best method/ rails way?</p>
  <h2>Method 1</h2>
  <p>I thought about just going in to my database &amp; dropping the table &amp; then destroying the model.</p>
  <pre><code>rails db
  DROP TABLE table_name
  \q
  rails destroy model model_name
  </code></pre>
  <p>If I do this what will happen to the migrations I have for this model/table?  I have two migrations for this model, a <strong>timestamp_create_modelname</strong> &amp; a add_attribute_to_table name.</p>
  <p>Also will this method update the <em>db/schema.rb</em> file?</p>
  <p>When I push the App to Heroku I suspect the Model will be removed but the table will remain in place, is there a heroku command to drop a table.</p>
  <h2>Method Two</h2>
  <p>Another way I read about was to generate a new migration to drop the table &amp; then destroy the model.</p>
  <pre><code>rails generate migration drop_tablename
  </code></pre>
  <p>&amp; then update the below file:</p>
  <p>db/migrate/timestamp_drop_tablename <strong>(updated in response to Dan Wich's answer below)</strong></p>
  <pre><code>class DropTablename &lt; ActiveRecord::Migration
    def up
      drop_table :tablename
    end
  
    def down
      create_table :tablename do |t|
        t.string :table_column
        t.references :anothertable
  
        t.timestamps        
      end
      add_index :tablenames, :anothertable_id
    end
  end
  </code></pre>
  <p>&amp; then in the terminal:</p>
  <pre><code>rake db:migrate
  rails destroy model model_name
  rake db:migrate
  git add .
  git commit -m &quot;removed table/model_name&quot;
  git push heroku master
  heroku run rake db:migrate
  heroku restart
  </code></pre>
  <p>This seems to be the best method but what happens to the older migration files?  Will they remain &amp; update db/schema every time I run rake db:migrate only to be overridden by db/migrate/timestamp_drop_tablename?</p>
  <p>I'm happy to experiment with the second method but would like someone with someone with experience to weigh in &amp; tell me the rails ways for doing this.</p>