Commit 02217397dbf60c3f7a62b2d753b9532303599226

Authored by Antonio Terceiro
1 parent 8d3b55fa

Fix migration

The pre-existing images must have their thumbnails_processed flag set to
true, since they indeed already had the thumbnails created!

(ActionItem1661)
db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb
... ... @@ -2,6 +2,9 @@ class AddThumbnailsProcessedToArticles < ActiveRecord::Migration
2 2 def self.up
3 3 add_column :articles, :thumbnails_processed, :boolean, :default => false
4 4 add_column :article_versions, :thumbnails_processed, :boolean, :default => false
  5 +
  6 + # the pre-existing images already had their thumbnails created before!
  7 + execute("update articles set thumbnails_processed = (1>0) where type = 'UploadedFile'")
5 8 end
6 9  
7 10 def self.down
... ...
db/migrate/20100901203836_add_thumbnails_processed_to_image.rb
1 1 class AddThumbnailsProcessedToImage < ActiveRecord::Migration
2 2 def self.up
3 3 add_column :images, :thumbnails_processed, :boolean, :default => false
  4 + # the pre-existing images already had their thumbnails created
  5 + execute('update images set thumbnails_processed = (1>0)')
4 6 end
5 7  
6 8 def self.down
7   - remove_column :images, :thumbnails_processed, :boolean, :default => false
  9 + remove_column :images, :thumbnails_processed
8 10 end
9 11 end
... ...