fixes #3574
This commit is contained in:
8
db/migrate/20180425194016_add_dmail_count_to_users.rb
Normal file
8
db/migrate/20180425194016_add_dmail_count_to_users.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class AddDmailCountToUsers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
ApplicationRecord.without_timeout do
|
||||
add_column :users, :unread_dmail_count, :integer, default: 0, null: false
|
||||
execute "update users set unread_dmail_count = (select count(*) from dmails where dmails.owner_id = users.id and dmails.is_read = false)"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user