To drop a table in Rails 5, run the following migration. Change
Posts to the name of your table, and make sure it’s plural.
rails g migration DropPosts
Open up the migration you’ve just generated inside db/migrate, and change it to the following:
class DropPosts < ActiveRecord::Migration[5.2] # change `Posts`
drop_table :posts # change `posts`
rails db:migrate. Your table should now be dropped.