Commit 02217397dbf60c3f7a62b2d753b9532303599226
1 parent
8d3b55fa
Exists in
master
and in
23 other branches
Fix migration
The pre-existing images must have their thumbnails_processed flag set to true, since they indeed already had the thumbnails created! (ActionItem1661)
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
db/migrate/20100831193450_add_thumbnails_processed_to_articles.rb
| @@ -2,6 +2,9 @@ class AddThumbnailsProcessedToArticles < ActiveRecord::Migration | @@ -2,6 +2,9 @@ class AddThumbnailsProcessedToArticles < ActiveRecord::Migration | ||
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :articles, :thumbnails_processed, :boolean, :default => false | 3 | add_column :articles, :thumbnails_processed, :boolean, :default => false |
| 4 | add_column :article_versions, :thumbnails_processed, :boolean, :default => false | 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 | end | 8 | end |
| 6 | 9 | ||
| 7 | def self.down | 10 | def self.down |
db/migrate/20100901203836_add_thumbnails_processed_to_image.rb
| 1 | class AddThumbnailsProcessedToImage < ActiveRecord::Migration | 1 | class AddThumbnailsProcessedToImage < ActiveRecord::Migration |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :images, :thumbnails_processed, :boolean, :default => false | 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 | end | 6 | end |
| 5 | 7 | ||
| 6 | def self.down | 8 | def self.down |
| 7 | - remove_column :images, :thumbnails_processed, :boolean, :default => false | 9 | + remove_column :images, :thumbnails_processed |
| 8 | end | 10 | end |
| 9 | end | 11 | end |