Skip to content

Commit

Permalink
quick fix to migrations order, subtle, related to publiclab#978
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Nov 29, 2016
1 parent 7c61897 commit d2d0994
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 d2d0994

Please sign in to comment.