cirandas.net

ref: master

db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class AddThumbnailsProcessedToArticles < ActiveRecord::Migration
  def self.up
     add_column :articles, :thumbnails_processed, :boolean, :default => false
     add_column :article_versions, :thumbnails_processed, :boolean, :default => false

     # the pre-existing images already had their thumbnails created before!
     execute("update articles set thumbnails_processed = (1>0) where type = 'UploadedFile'")
  end

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