feat: Add last_activity_at field to Notification model (#8585)

This commit is contained in:
Muhsin Keloth
2023-12-20 13:02:37 +05:30
committed by GitHub
parent a80eff9aa3
commit b5071e61d7
3 changed files with 16 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
class AddLastActivityAtToNotifications < ActiveRecord::Migration[7.0]
def change
add_column :notifications, :last_activity_at, :datetime, default: -> { 'CURRENT_TIMESTAMP' }
add_index :notifications, :last_activity_at
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_12_19_000743) do
ActiveRecord::Schema[7.0].define(version: 2023_12_19_073832) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "pg_trgm"
@@ -731,7 +731,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_12_19_000743) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "snoozed_until"
t.datetime "last_activity_at", default: -> { "CURRENT_TIMESTAMP" }
t.index ["account_id"], name: "index_notifications_on_account_id"
t.index ["last_activity_at"], name: "index_notifications_on_last_activity_at"
t.index ["primary_actor_type", "primary_actor_id"], name: "uniq_primary_actor_per_account_notifications"
t.index ["secondary_actor_type", "secondary_actor_id"], name: "uniq_secondary_actor_per_account_notifications"
t.index ["user_id"], name: "index_notifications_on_user_id"