Fixed: migration 98 breaks when using table name prefix.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2415 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-02-08 17:24:39 +00:00
parent b998572def
commit fc6d6b1e3b
1 changed files with 4 additions and 3 deletions

View File

@ -2,9 +2,10 @@ class SetTopicAuthorsAsWatchers < ActiveRecord::Migration
def self.up def self.up
# Sets active users who created/replied a topic as watchers of the topic # 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 # so that the new watch functionality at topic level doesn't affect notifications behaviour
Message.connection.execute("INSERT INTO watchers (watchable_type, watchable_id, user_id)" + Message.connection.execute("INSERT INTO #{Watcher.table_name} (watchable_type, watchable_id, user_id)" +
" SELECT DISTINCT 'Message', COALESCE(messages.parent_id, messages.id), messages.author_id FROM messages, users" + " SELECT DISTINCT 'Message', COALESCE(m.parent_id, m.id), m.author_id" +
" WHERE messages.author_id = users.id AND users.status = 1") " FROM #{Message.table_name} m, #{User.table_name} u" +
" WHERE m.author_id = u.id AND u.status = 1")
end end
def self.down def self.down