Hi all,
If I have the following migration:
class CreateDocuments < ActiveRecord::Migration
def self.up
create_table :documents do |t|
t.column :created_at, :datetime
t.column :identifier, :string
t.column :file_format, :string
end
add_index :documents, :identifier, :unique => true
end
def self.down
remove_index :documents, :identifier
drop_table :documents
end
end
Is it necessary (or recommended) to include the remove_index line in
the self.down method? I realize that dropping a table in MySQL will
automatically drop any indices on the table. However, I''m not sure if
this is the case for all databases. So would it be considered "good
style" to include the remove_index even though it''s normally a bit
redundant?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---