cirandas.net

ref: master

db/migrate/053_add_accept_comments_to_articles.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class AddAcceptCommentsToArticles < ActiveRecord::Migration
  def self.up
    add_column :articles, :accept_comments, :boolean, :default => true
    execute 'update articles set accept_comments = (1>0)'
    add_column :article_versions, :accept_comments, :boolean, :default => true
    execute 'update article_versions set accept_comments = (1>0)'
  end

  def self.down
    remove_column :articles, :accept_comments
    remove_column :article_versions, :accept_comments
  end
end