From 02217397dbf60c3f7a62b2d753b9532303599226 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 2 Sep 2010 18:19:31 -0300 Subject: [PATCH] Fix migration --- db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb | 3 +++ db/migrate/20100901203836_add_thumbnails_processed_to_image.rb | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb b/db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb index d04a658..2c8dece 100644 --- a/db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb +++ b/db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb @@ -2,6 +2,9 @@ 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 diff --git a/db/migrate/20100901203836_add_thumbnails_processed_to_image.rb b/db/migrate/20100901203836_add_thumbnails_processed_to_image.rb index ecf72a4..a450ead 100644 --- a/db/migrate/20100901203836_add_thumbnails_processed_to_image.rb +++ b/db/migrate/20100901203836_add_thumbnails_processed_to_image.rb @@ -1,9 +1,11 @@ class AddThumbnailsProcessedToImage < ActiveRecord::Migration def self.up add_column :images, :thumbnails_processed, :boolean, :default => false + # the pre-existing images already had their thumbnails created + execute('update images set thumbnails_processed = (1>0)') end def self.down - remove_column :images, :thumbnails_processed, :boolean, :default => false + remove_column :images, :thumbnails_processed end end -- libgit2 0.21.2