Mercurial > hg > soundsoftware-site
annotate .svn/pristine/ee/ee907116a1e49c7f20d5b7f90baa8602bf514e4e.svn-base @ 1296:038ba2d95de8 redmine-2.2
Fix redmine-2.2 branch update (add missing svn files)
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:05:06 +0100 |
parents | |
children |
rev | line source |
---|---|
Chris@1296 | 1 class ChangeAttachmentsContainerDefaults < ActiveRecord::Migration |
Chris@1296 | 2 def self.up |
Chris@1296 | 3 # Need to drop the index otherwise the following error occurs in Rails 3.1.3: |
Chris@1296 | 4 # |
Chris@1296 | 5 # Index name 'temp_index_altered_attachments_on_container_id_and_container_type' on |
Chris@1296 | 6 # table 'altered_attachments' is too long; the limit is 64 characters |
Chris@1296 | 7 remove_index :attachments, [:container_id, :container_type] |
Chris@1296 | 8 |
Chris@1296 | 9 change_column :attachments, :container_id, :integer, :default => nil, :null => true |
Chris@1296 | 10 change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true |
Chris@1296 | 11 Attachment.update_all "container_id = NULL", "container_id = 0" |
Chris@1296 | 12 Attachment.update_all "container_type = NULL", "container_type = ''" |
Chris@1296 | 13 |
Chris@1296 | 14 add_index :attachments, [:container_id, :container_type] |
Chris@1296 | 15 end |
Chris@1296 | 16 |
Chris@1296 | 17 def self.down |
Chris@1296 | 18 remove_index :attachments, [:container_id, :container_type] |
Chris@1296 | 19 |
Chris@1296 | 20 change_column :attachments, :container_id, :integer, :default => 0, :null => false |
Chris@1296 | 21 change_column :attachments, :container_type, :string, :limit => 30, :default => "", :null => false |
Chris@1296 | 22 |
Chris@1296 | 23 add_index :attachments, [:container_id, :container_type] |
Chris@1296 | 24 end |
Chris@1296 | 25 end |