journalduhacker/db/migrate/20120705145520_move_markdown_into_sql.rb
joshua stein 342d6ff911 move markeddown html into sql so it doesn't have to be generated every time
it's unlikely to change and if it does, we can just re-generate
everything in sql at once
2012-08-24 11:41:35 -05:00

24 lines
590 B
Ruby

class MoveMarkdownIntoSql < ActiveRecord::Migration
def up
add_column :comments, :markeddown_comment, :text
add_column :stories, :markeddown_description, :text
Comment.all.each do |c|
c.markeddown_comment = c.generated_markeddown_comment
Comment.record_timestamps = false
c.save(:validate => false)
end
Story.all.each do |s|
if s.description.present?
s.markeddown_description = s.generated_markeddown_description
Story.record_timestamps = false
s.save(:validate => false)
end
end
end
def down
end
end