バックアップから現在のバージョン情報を取得するにはどうすればいいですか?

タイトルに記載されているように、私のVPSが攻撃されました。./discourse-doctorを実行して現在のdiscourseのバージョン情報を取得しようとしましたが、失敗しました。

幸い、バックアップをローカルマシンにダウンロードしていました。
このバックアップから現在のバージョン情報をどうやって取得できますか?
ありがとうございます。

「いいね!」 2

どのような問題を解決しようとしていますか?バックアップはどの新しいバージョンにも復元できます。

「いいね!」 4

OSを再インストールしてから、プラグインの互換性の問題を避けるために以前のバージョンのDiscourseを設定しようとしています。

ちなみに、VPSがハッキングされた場合でも、Discourseのバックアップは可能ですか?数日前の自動バックアップしかありません。

それは、彼らがどのような状態にしたかによります。Railsコンソールを試すことができます:

cd /var/discourse 
./launcher enter app
discourse backup
cd public/backups/default
scp * user@destination.example.com:

バックアップファイル名は forumname-2025-05-22-151843-v20250521053324.tar.gz の形式になります。
末尾の長い文字列は、実行された最新のマイグレーションです。

それがどのコミットに属するかを知るには、

cd /var/www/discourse
git blame db/migrate/20250521053324*

これで出力が表示され、左側の列にコミットハッシュが含まれます。
これが、新しいフォーラムが到達すべき最小コミットです。

(コミットがプラグインに属している場合もあります。その場合は locate を使用してプラグインを見つけ、そのディレクトリに cd して同じ git blame のスタンザを実行してください)

「いいね!」 8

私は最新に更新することをお勧めします。最も簡単で、リスクもありません。もし動作しない場合は、素晴らしい指示に従ってコミットを見つけてその状態に復元することができます(そして、各プラグインも特定のコミットに復元しますか?)。

「いいね!」 1

バックアップの試行をしましたが、失敗しました。出力は次のとおりです:

# cd /var/discourse/
/var/discourse# ./launcher enter app
x86_64アーキテクチャが検出されました。
/var/www/discourse# discourse backup
バックアップ開始...
例外:BackupRestore::OperationRunningError
/var/www/discourse/lib/backup_restore/backuper.rb:70:in `ensure_no_operation_is_running'
/var/www/discourse/lib/backup_restore/backuper.rb:22:in `run'
スクリプト/discourse:84:in `backup'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
スクリプト/discourse:290:in `top (required)'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:28:in `top (required)'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:20:in `top (required)'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `main'
古いバックアップを削除中...
整理を実行中...
'.tar'の残骸を削除...
バックアップを完了としてマーク...
バックアップ終了の通知を 'system' に送信...
完了!
[FAILED]

これは、バックアップを行えないことを意味しますか?

別のバックアップが実行中だと思います。コンテナを再起動してから再試行してみてください。

アドバイスありがとうございます。
バックアップを正常に開始できました。
しかし、プロセスが約20分間この地点で停止しています(下のスクリーンショットを参照)。これは正常ですか?

はい、このテーブルはバグにより非常に大きくなる可能性があります。Clean up user_auth_token_logs? を参照してください。

問題が発生した場合は、バックアップを停止し、Railsコンソールに入力できます。

rails c
UserAuthTokenLog.delete_all

その後、バックアップを再開してください。

「いいね!」 3

ご提案ありがとうございます。最新のデータのバックアップは正常に完了しました。
さらに、OSを再インストール済みなので、app.ymlおよびバックアップファイルを使って直接最新の状態に復元するにはどうすればよいですか? 公式のドキュメントはありますか?それとも、最初に標準的なDockerインストール手順を完了してから、バックアップをインポートしてすべてを復元する必要がありますか?

ちなみに、私のDiscourseのバックアップがどのコミットに対応しているのか調べようとしたところ、次の出力が得られました。これはなぜでしょうか?

/var/www/discourse# git blame db/migrate/20240516145911*
fatal: no such path 'db/migrate/20240516145911*' in HEAD

これです!

スプiler:それはチャットプラグインに属しています。

root@testbeta:/var/www/discourse# locate 202405161459
/var/www/discourse/plugins/chat/db/migrate/20240516145911_update_user_options_for_thread_title_prompts.rb
root@testbeta:/var/www/discourse/plugins/chat# cd plugins/chat/
root@testbeta:/var/www/discourse/plugins/chat# git blame db/migrate/20240516145911*
「いいね!」 1

どうもありがとうございます!
:thinking: このメソッドは、チャットプラグインではなく、Discourse リポジトリ自体にコミットを生成するのでしょうか?もしそうであれば、その仕組みを説明していただけますか?

このガイドに従えばよいのでしょうか?
https://meta.discourse.org/t/restore-a-backup-from-the-command-line/

「いいね!」 2

ご提案いただいた方法を試しましたが、以下の問題が発生しました。
確認していただき、何が間違っていたか教えていただけますでしょうか?

/var/www/discourse# locate 20240516145911
/shared/backups/default/discourse-2025-05-24-113557-v20240516145911.tar.gz
/var/www/discourse/plugins/chat/db/post_migrate/20240516145911_update_user_options_for_thread_title_prompts.rb
root@tartali-app:/var/www/discourse# cd plugins/chat/
root@tartali-app:/var/www/discourse/plugins/chat# git blame db/migrate/20240516145911*
fatal: no such path 'plugins/chat/db/migrate/20240516145911*' in HEAD```

すみません。git blame db/post_migrate/20240516145911* で取得しました。これは出力です:

root@tartali-app:/var/www/discourse/plugins/chat# git blame db/post_migrate/20240516145911*
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (421/421), done.
remote: Total 2571 (delta 2), reused 1 (delta 1), pack-reused 2149 (from 1)
Receiving objects: 100% (2571/2571), 1008.42 KiB | 14.20 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
Receiving objects: 100% (2571/2571), 1007.76 KiB | 21.91 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2166 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (413/413), done.
remote: Compressing objects: 100% (413/413), done.
Receiving objects: 100% (2571/2571), 1007.81 KiB | 22.90 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2158 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (413/413), done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2158 (from 1)
Receiving objects: 100% (2571/2571), 1007.82 KiB | 22.40 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (413/413), done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2158 (from 1)
Receiving objects: 100% (2571/2571), 1007.81 KiB | 22.40 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
Receiving objects: 100% (2571/2571), 1007.76 KiB | 22.39 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2166 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
Receiving objects: 100% (2571/2571), 1007.76 KiB | 22.39 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2166 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (413/413), done.
remote: Compressing objects: 100% (413/413), done.
Receiving objects: 100% (2571/2571), 1007.78 KiB | 23.44 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2158 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (421/421), done.
remote: Total 2571 (delta 2), reused 1 (delta 1), pack-reused 2149 (from 1)
Receiving objects: 100% (2571/2571), 1008.39 KiB | 22.92 MiB/s, done.デルタを解決しています: 100% (2/2), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (422/422), 完了。
remote: オブジェクトを圧縮しています: 100% (421/421), 完了。
remote: 合計 2571 (デルタ 2), 再利用 1 (デルタ 1), パック再利用 2149 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1008.39 KiB | 22.41 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (404/404), 完了。
remote: オブジェクトを圧縮しています: 100% (404/404), 完了。
remote: 合計 2571 (デルタ 3), 再利用 0 (デルタ 0), パック再利用 2167 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1007.74 KiB | 21.91 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (422/422), 完了。
remote: オブジェクトを圧縮しています: 100% (421/421), 完了。
remote: 合計 2571 (デルタ 2), 再利用 1 (デルタ 1), パック再利用 2149 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1008.40 KiB | 22.92 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (422/422), 完了。
remote: オブジェクトを圧縮しています: 100% (421/421), 完了。
remote: 合計 2571 (デルタ 2), 再利用 1 (デルタ 1), パック再利用 2149 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1008.39 KiB | 22.41 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (414/414), 完了。
remote: オブジェクトを圧縮しています: 100% (414/414), 完了。
オブジェクトを受信しています: 100% (2571/2571), 1007.78 KiB | 22.90 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
remote: 合計 2571 (デルタ 3), 再利用 0 (デルタ 0), パック再利用 2157 (1 から)
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (403/403), 完了。
remote: オブジェクトを圧縮しています: 100% (403/403), 完了。
remote: 合計 2571 (デルタ 3), 再利用 0 (デルタ 0), パック再利用 2168 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1007.66 KiB | 22.39 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (413/413), 完了。
remote: オブジェクトを圧縮しています: 100% (413/413), 完了。
remote: 合計 2571 (デルタ 3), 再利用 0 (デルタ 0), パック再利用 2158 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1007.70 KiB | 12.44 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (412/412), 完了。
remote: オブジェクトを圧縮しています: 100% (412/412), 完了。
remote: 合計 2571 (デルタ 3), 再利用 0 (デルタ 0), パック再利用 2159 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1007.71 KiB | 22.39 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。
remote: オブジェクトを数えています: 100% (419/419), 完了。
remote: オブジェクトを圧縮しています: 100% (418/418), 完了。
remote: 合計 2571 (デルタ 2), 再利用 1 (デルタ 1), パック再利用 2152 (1 から)
オブジェクトを受信しています: 100% (2571/2571), 1008.31 KiB | 21.92 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: オブジェクトを列挙しています: 2571, 完了。remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2167 (from 1)
Receiving objects: 100% (2571/2571), 1007.66 KiB | 22.90 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (414/414), done.
remote: Compressing objects: 100% (414/414), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2157 (from 1)
Receiving objects: 100% (2571/2571), 1007.70 KiB | 12.00 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (412/412), done.
remote: Compressing objects: 100% (412/412), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2159 (from 1)
Receiving objects: 100% (2571/2571), 1007.70 KiB | 22.39 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
Receiving objects: 100% (2569/2569), 1006.98 KiB | 22.89 MiB/s, done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (418/418), done.
remote: Compressing objects: 100% (417/417), done.
Receiving objects: 100% (2569/2569), 1007.58 KiB | 22.90 MiB/s, done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2151 (from 1)
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.90 KiB | 22.88 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.75 KiB | 20.57 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.74 KiB | 23.44 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.55 KiB | 23.43 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.56 KiB | 23.43 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (418/418), done.
remote: Compressing objects: 100% (417/417), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2151 (from 1)
Receiving objects: 100% (2569/2569), 1007.56 KiB | 10.72 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.91 KiB | 22.38 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Receiving objects: 100% (2569/2569), 1006.90 KiB | 22.38 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
Receiving objects: 100% (2569/2569), 1006.88 KiB | 22.88 MiB/s, done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.89 KiB | 5.47 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (415/415), done.
remote: Compressing objects: 100% (415/415), done.
Receiving objects: 100% (2569/2569), 1006.89 KiB | 22.88 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2154 (from 1)
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (415/415), done.
remote: Compressing objects: 100% (415/415), done.
Receiving objects: 100% (2569/2569), 1006.89 KiB | 21.42 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2154 (from 1)
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (415/415), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1007.50 KiB | 23.43 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 13.98 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 19.36 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.29 KiB | 15.50 MiB/s, done.
Resolving deltas: 100% (2/2), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 16.50 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
Receiving objects: 100% (2569/2569), 1006.63 KiB | 22.37 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.29 KiB | 22.89 MiB/s, done.
Resolving deltas: 100% (2/2), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 21.42 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
Receiving objects: 100% (2569/2569), 1006.67 KiB | 20.13 MiB/s, done。.
デルタを解決しています: 100% (3/3), 完了。
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (417/417), 完了。
remote: オブジェクトを圧縮しています: 100% (416/416), 完了。
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
オブジェクトを受信しています: 100% (2569/2569), 1007.29 KiB | 21.43 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (416/416), 完了。
remote: オブジェクトを圧縮しています: 100% (416/416), 完了。
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
オブジェクトを受信しています: 100% (2569/2569), 1006.68 KiB | 21.88 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (415/415), 完了。
remote: オブジェクトを圧縮しています: 100% (414/414), 完了。
オブジェクトを受信しています: 100% (2569/2569), 1007.28 KiB | 23.42 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2154 (from 1)
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (415/415), 完了。
remote: オブジェクトを圧縮しています: 100% (415/415), 完了。
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2154 (from 1)
オブジェクトを受信しています: 100% (2569/2569), 1006.68 KiB | 17.98 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (417/417), 完了。
remote: オブジェクトを圧縮しています: 100% (416/416), 完了。
オブジェクトを受信しています: 100% (2569/2569), 1007.29 KiB | 22.89 MiB/s, 完了。
デルタを解決しています: 100% (2/2), 完了。
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (404/404), 完了。
remote: オブジェクトを圧縮しています: 100% (404/404), 完了。
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
オブジェクトを受信しています: 100% (2569/2569), 1006.63 KiB | 20.54 MiB/s, 完了。
デルタを解決しています: 100% (3/3), 完了。
最良のパフォーマンスを得るために、リポジトリをバックグラウンドで自動的にパックしています。
手動での整理については "git help gc" を参照してください。
remote: オブジェクトを列挙しています: 2569, 完了。
remote: オブジェクトをカウントしています: 100% (416/416), 完了。
remote: オブジェクトを圧縮しています: 100% (416/416), 完了。remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.68 KiB | 22.88 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 19.74 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (415/415), done.
remote: Compressing objects: 100% (415/415), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2154 (from 1)
Receiving objects: 100% (2569/2569), 1006.68 KiB | 14.18 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (415/415), done.
Receiving objects: 100% (2569/2569), 1007.14 KiB | 22.89 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2153 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.54 KiB | 22.37 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
Receiving objects: 100% (2569/2569), 1006.49 KiB | 22.37 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.53 KiB | 22.37 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done。remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.53 KiB | 18.99 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
Receiving objects: 100% (2569/2569), 1006.51 KiB | 22.37 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (404/404), done.
remote: Compressing objects: 100% (404/404), done.
Receiving objects: 100% (2569/2569), 1006.51 KiB | 22.88 MiB/s, done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (417/417), done.
remote: Compressing objects: 100% (417/417), done.
remote: Total 2569 (delta 2), reused 0 (delta 0), pack-reused 2152 (from 1)
Receiving objects: 100% (2569/2569), 1007.17 KiB | 13.80 MiB/s, done.
Resolving deltas: 100% (2/2), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
Receiving objects: 100% (2569/2569), 1006.56 KiB | 22.88 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (416/416), done.
remote: Compressing objects: 100% (416/416), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.56 KiB | 11.44 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (405/405), done.
remote: Compressing objects: 100% (405/405), done.
Receiving objects: 100% (2569/2569), 1006.45 KiB | 21.88 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2164 (from 1)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping。.
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  1) # frozen_string_literal: true
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  2)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  3) class UpdateUserOptionsForThreadTitlePrompts 00 Active
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  5)     change_column_default :user_options, :show_thread_title_prompts, true
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  6)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  7)     if DB.query_single(
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  8)          "SELECT 1 FROM user_options WHERE show_thread_title_prompts IS NULL LIMIT 1",
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  9)        ).first
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 10)       batch_size = 100_000
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 11)       min_id = DB.query_single("SELECT MIN(user_id) FROM user_options").first.to_i
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 12)       max_id = DB.query_single("SELECT MAX(user_id) FROM user_options").first.to_i
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 13)       while max_id >= min_id
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 14)         DB.exec(
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 15)           "UPDATE user_options SET show_thread_title_prompts = true WHERE user_id > #{max_id - batch_size} AND user_id <= #{max_id}",
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 16)         )
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 17)         max_id -= batch_size
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 18)       end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 19)     end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 20)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 21)     change_column_null :user_options, :show_thread_title_prompts, false
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 22)   end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 23)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 24)   def down
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 25)   end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 26) end
:...skipping...
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  1) # frozen_string_literal: true
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  2)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  3) class UpdateUserOptionsForThreadTitlePrompts 
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  4)   def up
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  5)     change_column_default :user_options, :show_thread_title_prompts, true
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  6)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  7)     if DB.query_single(
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  8)          "SELECT 1 FROM user_options WHERE show_thread_title_prompts IS NULL LIMIT 1",
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400  9)        ).first
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 10)       batch_size = 100_000
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 11)       min_id = DB.query_single("SELECT MIN(user_id) FROM user_options").first.to_i
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 12)       max_id = DB.query_single("SELECT MAX(user_id) FROM user_options").first.to_i
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 13)       while max_id >= min_id
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 14)         DB.exec(
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 15)           "UPDATE user_options SET show_thread_title_prompts = true WHERE user_id > #{max_id - batch_size} AND user_id <= #{max_id}",
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 16)         )
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 17)         max_id -= batch_size
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 18)       end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 19)     end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 20)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 21)     change_column_null :user_options, :show_thread_title_prompts, false
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 22)   end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 23)
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 24)   def down
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 25)   end
34c4acd32f5 (David Battersby 2024-05-17 00:53:19 +0400 26) end
~

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.