##// END OF EJS Templates
Rewrites UpdateMailNotificationValues migration to avoid model validations and failures....
Rewrites UpdateMailNotificationValues migration to avoid model validations and failures. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4368 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2361:fc6d6b1e3b27
r4254:73167fb4f26b
Show More
098_set_topic_authors_as_watchers.rb
15 lines | 749 B | text/x-ruby | RubyLexer
/ db / migrate / 098_set_topic_authors_as_watchers.rb
Jean-Philippe Lang
Adds watch/unwatch functionality at forum topic level (#1912)....
r1876 class SetTopicAuthorsAsWatchers < ActiveRecord::Migration
def self.up
# Sets active users who created/replied a topic as watchers of the topic
# so that the new watch functionality at topic level doesn't affect notifications behaviour
Jean-Philippe Lang
Fixed: migration 98 breaks when using table name prefix....
r2361 Message.connection.execute("INSERT INTO #{Watcher.table_name} (watchable_type, watchable_id, user_id)" +
" SELECT DISTINCT 'Message', COALESCE(m.parent_id, m.id), m.author_id" +
" FROM #{Message.table_name} m, #{User.table_name} u" +
" WHERE m.author_id = u.id AND u.status = 1")
Jean-Philippe Lang
Adds watch/unwatch functionality at forum topic level (#1912)....
r1876 end
def self.down
# Removes all message watchers
Watcher.delete_all("watchable_type = 'Message'")
end
end