Reputation: 6071
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.
Upvotes: 0
Views: 7449
Reputation: 6068
This can be achieved using migration with following command:-
def self.up
drop_table :table_name
end
Upvotes: 1
Reputation: 28934
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
Upvotes: 6