comparison db/migrate/20120223110929_change_attachments_container_defaults.rb @ 1526:404aa68d4227

Merge from live branch
author Chris Cannam
date Thu, 11 Sep 2014 12:46:20 +0100
parents dffacf8a6908
children
comparison
equal deleted inserted replaced
1493:a5f2bdf3b486 1526:404aa68d4227
6 # table 'altered_attachments' is too long; the limit is 64 characters 6 # table 'altered_attachments' is too long; the limit is 64 characters
7 remove_index :attachments, [:container_id, :container_type] 7 remove_index :attachments, [:container_id, :container_type]
8 8
9 change_column :attachments, :container_id, :integer, :default => nil, :null => true 9 change_column :attachments, :container_id, :integer, :default => nil, :null => true
10 change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true 10 change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true
11 Attachment.update_all "container_id = NULL", "container_id = 0" 11 Attachment.where("container_id = 0").update_all("container_id = NULL")
12 Attachment.update_all "container_type = NULL", "container_type = ''" 12 Attachment.where("container_type = ''").update_all("container_type = NULL")
13 13
14 add_index :attachments, [:container_id, :container_type] 14 add_index :attachments, [:container_id, :container_type]
15 end 15 end
16 16
17 def self.down 17 def self.down