これで大丈夫だと思います!
notifications.id だけでなく、notification_id を参照する他のテーブルの列も移行する必要があることに気づきました。そうでなければ、services/notifications.rb または services/badge_granter.rb でエラーが発生していました。
将来、同様の問題に直面する他の大規模なフォーラム設定のために、以下に実施したことを示します…
合計で、4つのテーブルの4つの列を移行する必要がありました。
notifications.iduser.seen_notification_iduser_badges.notification_idshelved_notifications.notification_id
当初は上記で提案された ALTER コマンドで #1 を行いましたが、その後、言及したように ActiveRecord のマイグレーションを使用することにしました。これにより、マイグレーションファイルがスキーマに追加されます。
20230215070319_change_notifications_id_to_bigint.rb
# frozen_string_literal: true
class ChangeNotificationsIdToBigint < ActiveRecord::Migration[6.1]
def change
change_column :notifications, :id, :bigint
end
end
20230215070320_change_user_seen_notification_id_to_bigint.rb
# frozen_string_literal: true
class ChangeUserSeenNotificationIdToBigint < ActiveRecord::Migration[6.1]
def change
change_column :users, :seen_notification_id, :bigint
end
end
20230215070321_change_user_badges_notification_id_to_bigint.rb
# frozen_string_literal: true
class ChangeUserBadgesNotificationIdToBigint < ActiveRecord::Migration[6.1]
def change
change_column :user_badges, :notification_id, :bigint
end
end
20230215070322_change_shelved_notifications_notification_id_to_bigint.rb
# frozen_string_literal: true
class ChangeShelvedNotificationsNotificationIdToBigint < ActiveRecord::Migration[6.1]
def change
change_column :shelved_notifications, :notification_id, :bigint
end
end
カスタム Dockerfile を使用しているため(Kubernetes 上で discourse と sidekiq を別々のリソースで実行できるようにイメージをビルドしています)、これらのファイルを /db/migrate にコピーするのは Dockerfile で簡単に行えました。
その後は rake db:migrate にすべてを任せました。すべての discourse および sidekiq ポッドでローリング再起動を行ったところ、すべてが期待どおりに動作しました
。