views:

22

answers:

1

I added a table that I thought I was going to need, but now no longer plan on using it. How should I remove that table?

I've already ran migrations, so the table is in my database. I figure rails generate migration should be able to handle this, but I haven't figured out how yet.

I've tried rails generate migration drop_tablename, but that just generated an empty migration.

What is the "offical" way to drop a table in Rails?

+2  A: 

You wont always be able to simply generate the migration to already have the code you want. You can create an empty migration and then populate it with the code you need.

You can find information about how to accomplish different tasks in a migration here:

http://api.rubyonrails.org/classes/ActiveRecord/Migration.html

More specifically, you can see how to drop a table using the following approach:

drop_table :table_name
Pete
Thank you. But apparently SO doesn't let me just say "thank you", I needed more characters :-)
Jason Whitehorn