comparison db/migrate/.svn/text-base/20100129193813_update_mail_notification_values.rb.svn-base @ 37:94944d00e43c

* Update to SVN trunk rev 4411
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 19 Nov 2010 13:24:41 +0000
parents
children af80e5618e9b
comparison
equal deleted inserted replaced
22:40f7cfd4df19 37:94944d00e43c
1 # Patch the data from a boolean change.
2 class UpdateMailNotificationValues < ActiveRecord::Migration
3 def self.up
4 User.update_all("mail_notification = 'all'", "mail_notification IN ('1', 't')")
5 User.update_all("mail_notification = 'selected'", "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)")
6 User.update_all("mail_notification = 'only_my_events'", "mail_notification NOT IN ('all', 'selected')")
7 end
8
9 def self.down
10 # No-op
11 end
12 end