mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
correct migration so it always populates column
This commit is contained in:
parent
7d59ff67b8
commit
6674611960
@ -4,11 +4,11 @@ class AddUnreadTrackingColumns < ActiveRecord::Migration
|
||||
add_column :topics, :last_unread_at, :datetime, null: false, default: "epoch"
|
||||
|
||||
execute <<SQL
|
||||
UPDATE topics SET last_unread_at = (
|
||||
UPDATE topics SET last_unread_at = COALESCE((
|
||||
SELECT MAX(created_at)
|
||||
FROM posts
|
||||
WHERE topics.id = posts.topic_id
|
||||
)
|
||||
), current_timestamp)
|
||||
SQL
|
||||
|
||||
execute <<SQL
|
||||
|
Loading…
Reference in New Issue
Block a user