annotate .svn/pristine/f1/f1e7ec3ddd71987a3970082b6263c9cd1a7b8343.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents dffacf8a6908
children
rev   line source
Chris@1517 1 class ChangeUsersMailNotificationToString < ActiveRecord::Migration
Chris@1517 2 def self.up
Chris@1517 3 rename_column :users, :mail_notification, :mail_notification_bool
Chris@1517 4 add_column :users, :mail_notification, :string, :default => '', :null => false
Chris@1517 5 User.where("mail_notification_bool = #{connection.quoted_true}").
Chris@1517 6 update_all("mail_notification = 'all'")
Chris@1517 7 User.where("EXISTS (SELECT 1 FROM #{Member.table_name} WHERE #{Member.table_name}.mail_notification = #{connection.quoted_true} AND #{Member.table_name}.user_id = #{User.table_name}.id)").
Chris@1517 8 update_all("mail_notification = 'selected'")
Chris@1517 9 User.where("mail_notification NOT IN ('all', 'selected')").
Chris@1517 10 update_all("mail_notification = 'only_my_events'")
Chris@1517 11 remove_column :users, :mail_notification_bool
Chris@1517 12 end
Chris@1517 13
Chris@1517 14 def self.down
Chris@1517 15 rename_column :users, :mail_notification, :mail_notification_char
Chris@1517 16 add_column :users, :mail_notification, :boolean, :default => true, :null => false
Chris@1517 17 User.where("mail_notification_char <> 'all'").
Chris@1517 18 update_all("mail_notification = #{connection.quoted_false}")
Chris@1517 19 remove_column :users, :mail_notification_char
Chris@1517 20 end
Chris@1517 21 end