Mercurial > hg > soundsoftware-site
annotate .svn/pristine/58/58f387ee590fb7d46f3341a09429ec5703adc38c.svn-base @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | |
children |
rev | line source |
---|---|
Chris@1517 | 1 class ChangeAttachmentsContainerDefaults < ActiveRecord::Migration |
Chris@1517 | 2 def self.up |
Chris@1517 | 3 # Need to drop the index otherwise the following error occurs in Rails 3.1.3: |
Chris@1517 | 4 # |
Chris@1517 | 5 # Index name 'temp_index_altered_attachments_on_container_id_and_container_type' on |
Chris@1517 | 6 # table 'altered_attachments' is too long; the limit is 64 characters |
Chris@1517 | 7 remove_index :attachments, [:container_id, :container_type] |
Chris@1517 | 8 |
Chris@1517 | 9 change_column :attachments, :container_id, :integer, :default => nil, :null => true |
Chris@1517 | 10 change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true |
Chris@1517 | 11 Attachment.where("container_id = 0").update_all("container_id = NULL") |
Chris@1517 | 12 Attachment.where("container_type = ''").update_all("container_type = NULL") |
Chris@1517 | 13 |
Chris@1517 | 14 add_index :attachments, [:container_id, :container_type] |
Chris@1517 | 15 end |
Chris@1517 | 16 |
Chris@1517 | 17 def self.down |
Chris@1517 | 18 remove_index :attachments, [:container_id, :container_type] |
Chris@1517 | 19 |
Chris@1517 | 20 change_column :attachments, :container_id, :integer, :default => 0, :null => false |
Chris@1517 | 21 change_column :attachments, :container_type, :string, :limit => 30, :default => "", :null => false |
Chris@1517 | 22 |
Chris@1517 | 23 add_index :attachments, [:container_id, :container_type] |
Chris@1517 | 24 end |
Chris@1517 | 25 end |