Skip to content

Commit

Permalink
quick fix to migrations order, subtle, related to #978 (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren authored Nov 29, 2016
1 parent 7c61897 commit 9c25b5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class AddCommentsCountToDrupalNode < ActiveRecord::Migration
def up
add_column :node, :comments_count, :integer, default: 0
add_column :node, :drupal_comments_count, :integer, default: 0
DrupalNode.reset_column_information
DrupalNode.all.each do |node|
DrupalNode.reset_counters(node.id, :comments)
DrupalNode.reset_counters(node.id, :drupal_comments)
end
end

def down
remove_column :node, :comments_count
remove_column :node, :drupal_comments_count
end
end
9 changes: 9 additions & 0 deletions db/migrate/20161129210111_change_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ChangeComments < ActiveRecord::Migration
def up
rename_column :node, :drupal_comments_count, :comments_count
end

def down
rename_column :node, :comments_count, :drupal_comments_count
end
end

0 comments on commit 9c25b5a

Please sign in to comment.