diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-23 11:15:39 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-23 11:15:39 +0000 |
commit | 10a37e27698e4087713a38b257513241f4a1db72 (patch) | |
tree | 393e0d084f9cd0007e3dd7c880cc8f9d9a5194e7 /db/migrate | |
parent | afa6c1a9a7365d27272af14aeaf9d8a0a3563e1f (diff) | |
download | redmine-10a37e27698e4087713a38b257513241f4a1db72.tar.gz redmine-10a37e27698e4087713a38b257513241f4a1db72.zip |
Makes container_id and container_type columns nullables.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8934 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20120223110929_change_attachments_container_defaults.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20120223110929_change_attachments_container_defaults.rb b/db/migrate/20120223110929_change_attachments_container_defaults.rb new file mode 100644 index 000000000..39af099f8 --- /dev/null +++ b/db/migrate/20120223110929_change_attachments_container_defaults.rb @@ -0,0 +1,13 @@ +class ChangeAttachmentsContainerDefaults < ActiveRecord::Migration + def self.up + 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 = ''" + end + + def self.down + change_column :attachments, :container_id, :integer, :default => 0, :null => false + change_column :attachments, :container_type, :string, :limit => 30, :default => "", :null => false + end +end |