Skip to content

Commit

Permalink
Adds a migration to fix buggy notes an drafts introduced by an earlie…
Browse files Browse the repository at this point in the history
…r version of Publify.

Issue publify#246.
  • Loading branch information
Frédéric de Villamil committed Sep 19, 2013
1 parent e44cd45 commit 8d3436e
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 8d3436e

Please sign in to comment.