Skip to content

Commit

Permalink
Merge pull request publify#250 from fdv/bugfix_7.x
Browse files Browse the repository at this point in the history
Adds a migration to fix buggy notes an drafts introduced by an earlier v...
  • Loading branch information
Frédéric de Villamil committed Sep 19, 2013
2 parents 63b417d + 8d3436e commit 0e9b6cb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions db/migrate/114_fixes_buggy_articles_and_notes.rb
@@ -0,0 +1,22 @@
class FixesBuggyArticlesAndNotes < ActiveRecord::Migration
def self.up
say "Fixing contents permalinks, this may take some time"

contents = Content.where("permalink is ? or permalink = ?", nil, '')
contents.each do |c|
c.set_permalink
c.save
end

say "Fixes empty notes GUID"
notes = Note.where("guid is ? or guid = ?", nil, '')
notes.each do |n|
n.create_guid
n.save
end
end

def self.down
say "Nothing to do here"
end
end

0 comments on commit 0e9b6cb

Please sign in to comment.