Sha256: 30cfb7af0d1c3da6ad0e8e8ed7c590c0f91fa04de94fb422a35e88fba56849c0

Contents?: true

Size: 749 Bytes

Versions: 34

Compression:

Stored size: 749 Bytes

Contents

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
    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")
  end

  def self.down
    # Removes all message watchers
    Watcher.delete_all("watchable_type = 'Message'")
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
redmine_extensions-0.0.39 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.38 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.37 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.11 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.10 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.36 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.34 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.09 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.07 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.06 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.05 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.04 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.03 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.33 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.02 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.1.01 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.29 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.28 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.27 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb
redmine_extensions-0.0.24 spec/redmine/db/migrate/098_set_topic_authors_as_watchers.rb