You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

041_rename_comment_to_comments.rb 912B

12345678910111213
  1. class RenameCommentToComments < ActiveRecord::Migration[4.2]
  2. def self.up
  3. rename_column(:comments, :comment, :comments) if ActiveRecord::Base.connection.columns(Comment.table_name).detect{|c| c.name == "comment"}
  4. rename_column(:wiki_contents, :comment, :comments) if ActiveRecord::Base.connection.columns(WikiContent.table_name).detect{|c| c.name == "comment"}
  5. rename_column(:wiki_content_versions, :comment, :comments) if ActiveRecord::Base.connection.columns(WikiContentVersion.table_name).detect{|c| c.name == "comment"}
  6. rename_column(:time_entries, :comment, :comments) if ActiveRecord::Base.connection.columns(TimeEntry.table_name).detect{|c| c.name == "comment"}
  7. rename_column(:changesets, :comment, :comments) if ActiveRecord::Base.connection.columns(Changeset.table_name).detect{|c| c.name == "comment"}
  8. end
  9. def self.down
  10. raise ActiveRecord::IrreversibleMigration
  11. end
  12. end