The drop_join_table
method is define in document drop_join_table
It takes table 1, table 2 names. Example: you have 2 tables named categories
and products
, and join table named categories_products
)
So create a migration file with any name you like, then you write code to delete join tables: :
def change
drop_join_table :categories, :products
end
you can pass in other options to drop_join_table
method, these options as the same like create_join_table
. Look at this method to see more options.
Example, if your join table does not have name follow convention, like categorization
, you could specify it:
def change
drop_join_table :categories, :products, table_name: categorization
end
To delete a table, it is simpler with drop_table
method:
def change
drop_table :table_name
end
Others option can be pass in to drop_table
method, like options of create_table
method