views:

28

answers:

2

Hi,

Is there a command to drop a specific table in the database and not all of them?

Or a way to update a database table

Thank you.

+1  A: 

Hi Brian,

This can be achieved using migration with following command:-

def self.up
drop_table :table_name
end

Thanks, Anubhaw

Anubhaw
+1  A: 

Check out the Ruby on Rails Migration Guide. For example, to drop a table in a migration:

class DropProducts < ActiveRecord::Migration
  def self.up
    drop_table :products
  end

  def self.down
    raise ActiveRecord::IrreversibleMigration
  end
end
Pär Wieslander