discourse/app/models/shelved_notification.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
627 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
class ShelvedNotification < ActiveRecord::Base
DEV: Migrate notifications#id and related columns to bigint (#28584) * DEV: Migrate notifications#id to bigint (#28444) The `notifications.id` column is the most probable column to run out of values. This is because it is an `int` column that has only 2147483647 values and many notifications are generated on a regular basis in an active community. This commit migrates the column to `bigint`. These migrations do not use `ALTER TABLE ... COLUMN ... TYPE` in order to avoid the `ACCESS EXCLUSIVE` lock on the entire table. Instead, they create a new `bigint` column, copy the values to the new column and then sets the new column as primary key. Related columns (see `user_badges`, `shelved_notifications`) will be migrated in a follow-up commit. * DEV: Fix bigint notifications id migration to deal with public schema (#28538) Follow up to 799a45a291e9f2bd94278f565e58874458768079 * DEV: Migrate shelved_notifications#notification_id to bigint (#28549) DEV: Migrate shelved_notifications#notification_id to bigint The `notifications.id` has been migrated to `bigint` in previous commit 799a45a291e9f2bd94278f565e58874458768079. * DEV: Fix annotations (#28569) Follow-up to ec8ba5a0b9ff8dbefae74d6ec4f08dc13e418c6b * DEV: Migrate user_badges#notification_id to bigint (#28546) The `notifications.id` has been migrated to bigint in previous commit 799a45a291e9f2bd94278f565e58874458768079. This commit migrates one of the related columns, `user_badges.notification_id`, to `bigint`. * DEV: Migrate `User#seen_notification_id` to `bigint` (#28572) `Notification#id` was migrated to `bigint` in 799a45a291e9f2bd94278f565e58874458768079 * DEV: Migrate `Chat::NotificationMention#notification_id` to `bigint` (#28571) `Notification#id` was migrated to `bigint` in 799a45a291e9f2bd94278f565e58874458768079 --------- Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2024-08-29 11:06:55 -04:00
self.ignored_columns = [
:old_notification_id, # TODO: Remove when column is dropped. At this point, the migration to drop the column has not been writted.
]
belongs_to :notification
def process
NotificationEmailer.process_notification(notification, no_delay: true)
end
end
# == Schema Information
#
# Table name: shelved_notifications
#
# id :bigint not null, primary key
DEV: Migrate notifications#id and related columns to bigint (#28584) * DEV: Migrate notifications#id to bigint (#28444) The `notifications.id` column is the most probable column to run out of values. This is because it is an `int` column that has only 2147483647 values and many notifications are generated on a regular basis in an active community. This commit migrates the column to `bigint`. These migrations do not use `ALTER TABLE ... COLUMN ... TYPE` in order to avoid the `ACCESS EXCLUSIVE` lock on the entire table. Instead, they create a new `bigint` column, copy the values to the new column and then sets the new column as primary key. Related columns (see `user_badges`, `shelved_notifications`) will be migrated in a follow-up commit. * DEV: Fix bigint notifications id migration to deal with public schema (#28538) Follow up to 799a45a291e9f2bd94278f565e58874458768079 * DEV: Migrate shelved_notifications#notification_id to bigint (#28549) DEV: Migrate shelved_notifications#notification_id to bigint The `notifications.id` has been migrated to `bigint` in previous commit 799a45a291e9f2bd94278f565e58874458768079. * DEV: Fix annotations (#28569) Follow-up to ec8ba5a0b9ff8dbefae74d6ec4f08dc13e418c6b * DEV: Migrate user_badges#notification_id to bigint (#28546) The `notifications.id` has been migrated to bigint in previous commit 799a45a291e9f2bd94278f565e58874458768079. This commit migrates one of the related columns, `user_badges.notification_id`, to `bigint`. * DEV: Migrate `User#seen_notification_id` to `bigint` (#28572) `Notification#id` was migrated to `bigint` in 799a45a291e9f2bd94278f565e58874458768079 * DEV: Migrate `Chat::NotificationMention#notification_id` to `bigint` (#28571) `Notification#id` was migrated to `bigint` in 799a45a291e9f2bd94278f565e58874458768079 --------- Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2024-08-29 11:06:55 -04:00
# notification_id :bigint not null
#
# Indexes
#
# index_shelved_notifications_on_notification_id (notification_id)
#