GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Functional Blogging
Homepage: http://www.crossconnector.com
Clone URL: git://github.com/artofmission/crossconnector.git
Click here to lend your support to: crossconnector and make a donation at www.pledgie.com !
crossconnector / crossconnector.user / db / migrate / 016_add_extended_options.rb
100644 22 lines (15 sloc) 0.601 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class AddExtendedOptions < ActiveRecord::Migration
  def self.up
    STDERR.puts "Migrating to version 16..."
    
    add_column "messages", "extended", :text
    add_column "messages", "extended_html", :text
    
    STDERR.puts "done."
  end
 
  def self.down
    STDERR.puts "Migrating down from version 16..."
    
    Message.find(:all).each { |msg| msg.update_attributes(:body => msg.body + msg.extended, :body_html => msg.body_html + msg.extended_html) }
    
    remove_column "messages", "extended"
    remove_column "messages", "extended_html"
    
    STDERR.puts "done."
  end
end