Mercurial > hg > soundsoftware-site
diff .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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.svn/pristine/ee/ee907116a1e49c7f20d5b7f90baa8602bf514e4e.svn-base Fri Jun 14 09:05:06 2013 +0100 @@ -0,0 +1,25 @@ +class ChangeAttachmentsContainerDefaults < ActiveRecord::Migration + def self.up + # Need to drop the index otherwise the following error occurs in Rails 3.1.3: + # + # Index name 'temp_index_altered_attachments_on_container_id_and_container_type' on + # table 'altered_attachments' is too long; the limit is 64 characters + remove_index :attachments, [:container_id, :container_type] + + change_column :attachments, :container_id, :integer, :default => nil, :null => true + change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true + Attachment.update_all "container_id = NULL", "container_id = 0" + Attachment.update_all "container_type = NULL", "container_type = ''" + + add_index :attachments, [:container_id, :container_type] + end + + def self.down + remove_index :attachments, [:container_id, :container_type] + + change_column :attachments, :container_id, :integer, :default => 0, :null => false + change_column :attachments, :container_type, :string, :limit => 30, :default => "", :null => false + + add_index :attachments, [:container_id, :container_type] + end +end