How to Drop table in rails
Step 01 ::: Run the below command :: This will create new migration file
rails generate migration drop_tablename
Step 02 ::: Add these below two methods in that migration
def up
drop_table :products
end
def down
raise ActiveRecord::IrreversibleMigration
endStep 03 ::: rake db:migrate
This will drop the Table.
Comments
Post a Comment