Как получить информацию о текущей версии из моей резервной копии?

Как указано в заголовке, мой VPS подвергся атаке. Я попытался получить информацию о текущей версии Discourse, запустив ./discourse-doctor, но это не удалось.

К счастью, у меня была сделана резервная копия на локальном компьютере.
Как можно получить информацию о текущей версии из этой резервной копии?
Спасибо.

Какую проблему вы пытаетесь решить? Вы можете восстановить резервную копию до любой более новой версии.

Я планирую переустановить ОС, а затем настроить предыдущую версию 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, чтобы найти плагин, перейдите в его директорию и выполните тот же блок команды git blame).

Я бы порекомендовал просто обновиться до последней версии. Это самый простой способ, и риска нет. Если это не сработает, вы сможете следовать этим отличным инструкциям, чтобы найти нужный коммит и откатиться к нему (и собираетесь ли вы также откатить каждый плагин к какому-то конкретному коммиту?).

Я попытался выполнить резервное копирование, но оно не удалось. Вот вывод:

# 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'
script/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'
script/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 `block 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'...
Пометка резервной копии как завершенной...
Уведомление системы о завершении резервного копирования...
Готово!
[FAILED]

Это означает, что я не смогу выполнить резервное копирование?

Система считает, что другое резервное копирование уже выполняется. Попробуйте перезагрузить контейнер и повторить попытку.

Спасибо за ваш совет.
Мне удалось успешно запустить резервное копирование.
Однако процесс уже около 20 минут застрял на этом этапе (см. скриншот ниже). Это нормально?

Да, эта таблица может стать очень большой из-за ошибки, см. Clean up user_auth_token_logs?

Если это станет проблемой, вы можете остановить резервное копирование, войти в консоль Rails

rails c
UserAuthTokenLog.delete_all

а затем перезапустить резервное копирование.

Спасибо за ваше предложение. Я успешно создал резервную копию последних данных.
Кроме того, поскольку операционная система уже переустановлена, как я могу восстановить последнее состояние напрямую, используя app.yml и файлы резервной копии? Есть ли для этого официальная документация? Или мне сначала нужно пройти стандартный процесс установки Docker, а затем импортировать резервную копию для восстановления всего?

Кстати, когда я попытался узнать, какому коммиту соответствует моя резервная копия Discourse, я получил следующий вывод. Есть ли у вас идеи, почему это могло произойти?

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

Именно!

Спойлер: он относится к плагину chat.

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# cd plugins/chat/
root@testbeta:/var/www/discourse/plugins/chat# git blame db/migrate/20240516145911*

Спасибо большое!
Я не совсем уверен :thinking: создаёт ли этот метод коммит в сам репозиторий Discourse, а не в плагин чата? Если да, не могли бы вы объяснить механизм, лежащий в основе этого?

Похоже, я могу следовать этой инструкции?
https://meta.discourse.org/t/restore-a-backup-from-the-command-line/

Я попробовал способ, который вы рекомендовали, но столкнулся со следующей проблемой.
Не могли бы вы взглянуть и подсказать, что могло пойти не так?

/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

Sorry. I got it by git blame db/post_migrate/20240516145911*

This is the output:

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.
Resolving deltas: 100% (2/2), done.
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.41 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2571, done.
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.74 KiB | 21.91 MiB/s, done.
Resolving deltas: 100% (3/3), done.
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.40 KiB | 22.92 MiB/s, done.
Resolving deltas: 100% (2/2), done.
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.41 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (414/414), done.
remote: Compressing objects: 100% (414/414), done.
Receiving objects: 100% (2571/2571), 1007.78 KiB | 22.90 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2157 (from 1)
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (403/403), done.
remote: Compressing objects: 100% (403/403), done.
remote: Total 2571 (delta 3), reused 0 (delta 0), pack-reused 2168 (from 1)
Receiving objects: 100% (2571/2571), 1007.66 KiB | 22.39 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.70 KiB | 12.44 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.71 KiB | 22.39 MiB/s, done.
Resolving deltas: 100% (3/3), done.
remote: Enumerating objects: 2571, done.
remote: Counting objects: 100% (419/419), done.
remote: Compressing objects: 100% (418/418), done.
remote: Total 2571 (delta 2), reused 1 (delta 1), pack-reused 2152 (from 1)
Receiving objects: 100% (2571/2571), 1008.31 KiB | 21.92 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 2571, done.
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.
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% (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 | 21.43 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.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2153 (from 1)
Receiving objects: 100% (2569/2569), 1006.68 KiB | 21.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% (415/415), done.
remote: Compressing objects: 100% (414/414), done.
Receiving objects: 100% (2569/2569), 1007.28 KiB | 23.42 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2154 (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% (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 | 17.98 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.
Receiving objects: 100% (2569/2569), 1007.29 KiB | 22.89 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Total 2569 (delta 2), reused 1 (delta 1), pack-reused 2152 (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.
remote: Total 2569 (delta 3), reused 0 (delta 0), pack-reused 2165 (from 1)
Receiving objects: 100% (2569/2569), 1006.63 KiB | 20.54 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.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 < ActiveRecord::Migration[7.0]
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
:...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 < ActiveRecord::Migration[7.0]
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
~