mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
799a45a291
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.
12 lines
248 B
Ruby
12 lines
248 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AlterNotificationsIdSequenceToBigint < ActiveRecord::Migration[7.0]
|
|
def up
|
|
execute "ALTER SEQUENCE notifications_id_seq AS bigint"
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|