@@ -0,0 +1,13 | |||||
|
1 | class ChangeAttachmentsContainerDefaults < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | change_column :attachments, :container_id, :integer, :default => nil, :null => true | |||
|
4 | change_column :attachments, :container_type, :string, :limit => 30, :default => nil, :null => true | |||
|
5 | Attachment.update_all "container_id = NULL", "container_id = 0" | |||
|
6 | Attachment.update_all "container_type = NULL", "container_type = ''" | |||
|
7 | end | |||
|
8 | ||||
|
9 | def self.down | |||
|
10 | change_column :attachments, :container_id, :integer, :default => 0, :null => false | |||
|
11 | change_column :attachments, :container_type, :string, :limit => 30, :default => "", :null => false | |||
|
12 | end | |||
|
13 | end |
General Comments 0
You need to be logged in to leave comments.
Login now