Skip to content

Commit

Permalink
Make content migration more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetised committed May 18, 2016
1 parent 62d5833 commit 9668cf0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db/migrations/20150320130000_fix_hidden_origins.rb
Expand Up @@ -13,14 +13,14 @@
aliases.each do |a|
target = a.target
if target.hidden?
a.send :apply_set_visible, false, target.id
a.send :apply_set_visible!, false, target.id
a.save
else
# The bug set the hidden origin to the id of the parent, not the target
# so we want to clear that unless the alias was actually hidden directly
# i.e. has a hidden_origin == nil
unless a.hidden_origin.nil?
a.send :apply_set_visible, true, nil
a.send :apply_set_visible!, true, nil
a.save
end
end
Expand Down
1 change: 1 addition & 0 deletions db/migrations/20150717164419_mark_page_modified.rb
Expand Up @@ -3,6 +3,7 @@
Sequel.migration do
up do
[:content, :spontaneous_content_history, :spontaneous_content_archive].each do |table|
next if self[table].columns.include?(:touched_at)
add_column table, :touched_at, :varchar, default: nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/spontaneous/model/core/content_hash.rb
Expand Up @@ -73,7 +73,7 @@ def content_hash_dependencies(&calculation)
end

def content_hash_columns
[schema_id, hidden?, target_id, owner_id, touched_at]
[schema_id, hidden?, target_id, owner_id, try(:touched_at)]
end

def before_save
Expand Down

0 comments on commit 9668cf0

Please sign in to comment.