koba-lab / mastodon

A GNU Social-compatible microblogging server
https://ika.queloud.net
GNU Affero General Public License v3.0
5 stars 7 forks source link

migrationを正常に通し切る #534

Closed koba-lab closed 7 months ago

koba-lab commented 2 years ago

v3.5.3に上げる際、migrationが一部エラーが起こったため、未反映となっている。 v4に上げる前にmigrationをちゃんと通るようにしたい。

koba-lab commented 2 years ago

参考メモ置き場

https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/

https://mastodon.juggler.jp/@tateisu/105323944239526101

koba-lab commented 7 months ago

Mastodonで脆弱性が確認されたので早くやらねば

https://github.com/mastodon/mastodon/security/advisories/GHSA-3fjr-858r-92rw

やること確認

■ migrationコマンド

docker-compose run --rm web rails db:migrate
koba-lab commented 7 months ago

3.5.3 の空dbでmigrationが通ることを確認する

これは確認できた。

3.5.3 でimportした状態のDBでmigrationが通らないことを確認する

次はこれを確認していく。

koba-lab commented 7 months ago

エラー出た これが本番で出てたエラーかどうかは不明

 % docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web rails db:migrate
[+] Creating 2/0
 ✔ Container mastodon-db-1     Running                                            0.0s 
 ✔ Container mastodon-redis-1  Running                                            0.0s 
I, [2024-02-01T22:51:40.914557 #7]  INFO -- : Migrating to CreateCustomFilters (20180628181026)
== 20180628181026 CreateCustomFilters: migrating ==============================
[strong_migrations] DANGER: No lock timeout set
-- create_table(:custom_filters)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "custom_filters" already exists
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:326:in `create_table'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:965:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:954:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:16:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/checker.rb:322:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:15:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:556:in `create_table'
/opt/mastodon/db/migrate/20180628181026_create_custom_filters.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:905:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:889:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:888:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:887:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1095:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1409:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:209:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1460:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1408:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1481:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1496:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1477:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1166:in `up'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1141:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/command.rb:51:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/mastodon/bin/rails:4:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "custom_filters" already exists
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:326:in `create_table'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:965:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:954:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:16:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/checker.rb:322:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:15:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:556:in `create_table'
/opt/mastodon/db/migrate/20180628181026_create_custom_filters.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:905:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:889:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:888:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:887:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1095:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1409:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:209:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1460:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1408:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1481:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1496:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1477:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1166:in `up'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1141:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/command.rb:51:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/mastodon/bin/rails:4:in `<main>'

Caused by:
PG::DuplicateTable: ERROR:  relation "custom_filters" already exists
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:326:in `create_table'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:965:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:935:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:954:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:16:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/checker.rb:322:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:15:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:556:in `create_table'
/opt/mastodon/db/migrate/20180628181026_create_custom_filters.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:905:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:889:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:888:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:887:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1095:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1409:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/transactions.rb:209:in `transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1460:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1408:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1382:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1481:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1496:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1477:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1331:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1166:in `up'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/migration.rb:1141:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/strong_migrations-0.8.0/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/command.rb:51:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/mastodon/bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
koba-lab commented 7 months ago

とりあえず bin/tootctl maintenance fix-duplicates を試してみます

koba-lab commented 7 months ago
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_params': PG::UndefinedTable: ERROR:  relation "software_updates" does not exist (ActiveRecord::StatementInvalid)
LINE 1: DELETE FROM "software_updates"
                    ^

        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:767:in `block in exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:67:in `exec_delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:181:in `delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:617:in `delete_all'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/querying.rb:22:in `delete_all'
        from /opt/mastodon/lib/mastodon/cli/maintenance.rb:553:in `deduplicate_software_updates!'
        from /opt/mastodon/lib/mastodon/cli/maintenance.rb:175:in `fix_duplicates'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:116:in `invoke'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:243:in `block in subcommand'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
        from bin/tootctl:9:in `block in <main>'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
        from bin/tootctl:8:in `<main>'
/opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_params': ERROR:  relation "software_updates" does not exist (PG::UndefinedTable)
LINE 1: DELETE FROM "software_updates"
                    ^

        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:767:in `block in exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:752:in `block in log'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:743:in `log'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:766:in `exec_no_cache'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:745:in `execute_and_clear'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:67:in `exec_delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:181:in `delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `delete'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation.rb:617:in `delete_all'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/querying.rb:22:in `delete_all'
        from /opt/mastodon/lib/mastodon/cli/maintenance.rb:553:in `deduplicate_software_updates!'
        from /opt/mastodon/lib/mastodon/cli/maintenance.rb:175:in `fix_duplicates'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:116:in `invoke'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:243:in `block in subcommand'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
        from bin/tootctl:9:in `block in <main>'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy/strategy.rb:60:in `wrap'
        from /opt/mastodon/vendor/bundle/ruby/3.2.0/gems/chewy-7.3.4/lib/chewy.rb:154:in `strategy'
        from bin/tootctl:8:in `<main>'

エラーが

localのDB見てみると software_updates っていうテーブルは存在してない 本番のDB見てみても存在してない 3.5.3の本家のschema見ても存在してない

実行中のmastodonのバージョンは…

4.2.5 だった。

docker-compose up --build して再実行します。。

koba-lab commented 7 months ago

ウーンビルドエラー

 => ERROR [web build-dep 5/7] RUN npm install -g npm@latest &&  npm install -g yarn &&  gem install bundler &&  apt-get update &&  apt-get install -y --no-install-recommends git l  0.5s 
------                                                                                                                                                                                    
 > [web build-dep 5/7] RUN npm install -g npm@latest &&         npm install -g yarn &&  gem install bundler &&  apt-get update &&       apt-get install -y --no-install-recommends git libicu-dev libidn11-dev    libpq-dev shared-mime-info:                                                                                                                                       
0.435 npm notice                                                                                                                                                                          
0.435 npm notice New major version of npm available! 8.5.0 -> 10.4.0                                                                                                                      
0.435 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.4.0>
0.435 npm notice Run `npm install -g npm@10.4.0` to update!
0.435 npm notice 
0.435 npm ERR! code EBADENGINE
0.436 npm ERR! engine Unsupported engine
0.436 npm ERR! engine Not compatible with your version of node/npm: npm@10.4.0
0.436 npm ERR! notsup Not compatible with your version of node/npm: npm@10.4.0
0.436 npm ERR! notsup Required: {"node":"^18.17.0 || >=20.5.0"}
0.436 npm ERR! notsup Actual:   {"npm":"8.5.0","node":"v16.14.2"}
0.436 
0.436 npm ERR! A complete log of this run can be found in:
0.436 npm ERR!     /root/.npm/_logs/2024-02-02T08_14_45_791Z-debug-0.log
------
failed to solve: process "/bin/bash -c npm install -g npm@latest && \tnpm install -g yarn && \tgem install bundler && \tapt-get update && \tapt-get install -y --no-install-recommends git libicu-dev libidn11-dev \tlibpq-dev shared-mime-info" did not complete successfully: exit code: 1

Dockerfileを一時的に修正して再実行する

-RUN npm install -g npm@latest && \
+RUN npm install -g npm@8 && \
koba-lab commented 7 months ago

ビルド通った

3.5.3 になっているのも確認

 % docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web bin/tootctl --version
[+] Creating 2/0
 ✔ Container mastodon-redis-1  Running                                                                                                                                             0.0s 
 ✔ Container mastodon-db-1     Running                                                                                                                                             0.0s 
3.5.3

docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web bin/tootctl maintenance fix-duplicates を再実行します

koba-lab commented 7 months ago
% docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web bin/tootctl maintenance fix-duplicates
[+] Creating 2/0
 ✔ Container mastodon-redis-1  Running                                                                                                                                             0.0s 
 ✔ Container mastodon-db-1     Running                                                                                                                                             0.0s 
This task will take a long time to run and is potentially destructive.
Please make sure to stop Mastodon and have a backup.
Continue? (Yes/No) Yes
Deduplicating user records…
Restoring users indexes…
Removing duplicate account domain blocks…
...
Restoring index_accounts_on_username_and_domain_lower…
Reindexing textual indexes on accounts…
Deduplicating tags…
Restoring tags indexes…
Reindexing textual indexes on tags…
Deduplicating webauthn_credentials…
Restoring webauthn_credentials indexes…
Finished!

成功した。migrationしてみる。

% docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web rails db:migrate
[+] Creating 2/0
 ✔ Container mastodon-redis-1  Running                                                                                                                                             0.0s 
 ✔ Container mastodon-db-1     Running                                                                                                                                             0.0s 
Migrating to AddIndexStatusesOnAccountId (20220428112511)
== 20220428112511 AddIndexStatusesOnAccountId: migrating ======================
[strong_migrations] DANGER: No lock timeout set
-- add_index(:statuses, [:account_id], {:name=>:index_statuses_on_account_id, :algorithm=>:concurrently})
rails aborted!
StandardError: An error has occurred, all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "index_statuses_on_account_id" already exists
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:448:in `add_index'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:929:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:918:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:13:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/checker.rb:339:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:12:in `method_missing'
/opt/mastodon/db/migrate/20220428112511_add_index_statuses_on_account_id.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:867:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:850:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:849:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1037:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1382:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1086:in `up'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1061:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/command.rb:50:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands.rb:18:in `<top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/bin/rails:4:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "index_statuses_on_account_id" already exists
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:448:in `add_index'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:929:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:918:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:13:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/checker.rb:339:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:12:in `method_missing'
/opt/mastodon/db/migrate/20220428112511_add_index_statuses_on_account_id.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:867:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:850:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:849:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1037:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1382:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1086:in `up'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1061:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/command.rb:50:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands.rb:18:in `<top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/bin/rails:4:in `<main>'

Caused by:
PG::DuplicateTable: ERROR:  relation "index_statuses_on_account_id" already exists
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:448:in `add_index'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:929:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `block in say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:897:in `say_with_time'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:918:in `method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:13:in `block in method_missing'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/checker.rb:339:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:12:in `method_missing'
/opt/mastodon/db/migrate/20220428112511_add_index_statuses_on_account_id.rb:5:in `change'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:867:in `exec_migration'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:850:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:849:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/migration.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1037:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1382:in `ddl_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1251:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `block in migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/strategy.rb:57:in `wrap'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy.rb:154:in `strategy'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/chewy-7.2.4/lib/chewy/railtie.rb:28:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1086:in `up'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/migration.rb:1061:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/strong_migrations-0.7.9/lib/strong_migrations/database_tasks.rb:5:in `migrate'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/command.rb:50:in `invoke'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/railties-6.1.6/lib/rails/commands.rb:18:in `<top (required)>'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/mastodon/bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

ウーンエラーが…

koba-lab commented 7 months ago

localで構築したDBも本番のDBも migrationの最終versionは 20210324171613 だったので、恐らく本番でもこのエラーが出るんだと思われる。

koba-lab commented 7 months ago

該当のインデックスを削除しようかと思いましたが、他にもmigrationがあるようだったので、試しに db:migrate:reset してみたら通った。

docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web rails DISABLE_DATABASE_ENVIRONMENT_CHECK=1 db:migrate:reset

当たり前ですがデータは全て吹っ飛んでいます。 この状態で schema_migrations テーブル以外のデータをrestoreすればいけるか?

と、思いましたが怖いので、一旦エラー解消しながら進める方向でやってみます。 泥沼にハマったらリセットで。。。

koba-lab commented 7 months ago
DROP INDEX index_statuses_on_account_id;

これだけでいけた めちゃ簡単だった。。。

koba-lab commented 7 months ago

本番でも同じエラーが出てた。インデックス削除で対応します。

$ docker-compose run --rm web rails db:migrate
Migrating to AddIndexStatusesOnAccountId (20220428112511)
== 20220428112511 AddIndexStatusesOnAccountId: migrating ======================
[strong_migrations] DANGER: No lock timeout set
-- add_index(:statuses, [:account_id], {:name=>:index_statuses_on_account_id, :algorithm=>:concurrently})
rails aborted!
StandardError: An error has occurred, all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "index_statuses_on_account_id" already exists
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `block (2 levels) in execute'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block in execute'
...
koba-lab commented 7 months ago

本番で通った。ヤッター!

$ docker-compose run --rm web rails db:migrate
Migrating to AddIndexStatusesOnAccountId (20220428112511)
== 20220428112511 AddIndexStatusesOnAccountId: migrating ======================
[strong_migrations] DANGER: No lock timeout set
-- add_index(:statuses, [:account_id], {:name=>:index_statuses_on_account_id, :algorithm=>:concurrently})
   -> 30.2170s
== 20220428112511 AddIndexStatusesOnAccountId: migrated (30.2209s) ============

Migrating to AddIndexStatusesPinsOnStatusId (20220428112727)
== 20220428112727 AddIndexStatusesPinsOnStatusId: migrating ===================
[strong_migrations] DANGER: No lock timeout set
-- add_index(:status_pins, [:status_id], {:name=>:index_status_pins_on_status_id, :algorithm=>:concurrently})
   -> 0.1204s
== 20220428112727 AddIndexStatusesPinsOnStatusId: migrated (0.1230s) ==========

Migrating to AddIndexReportsOnAssignedAccountId (20220428114454)
== 20220428114454 AddIndexReportsOnAssignedAccountId: migrating ===============
[strong_migrations] DANGER: No lock timeout set
-- add_index(:reports, [:assigned_account_id], {:name=>:index_reports_on_assigned_account_id, :algorithm=>:concurrently, :where=>"assigned_account_id IS NOT NULL"})
   -> 0.0088s
== 20220428114454 AddIndexReportsOnAssignedAccountId: migrated (0.0102s) ======

Migrating to AddIndexReportsOnActionTakenByAccountId (20220428114902)
== 20220428114902 AddIndexReportsOnActionTakenByAccountId: migrating ==========
[strong_migrations] DANGER: No lock timeout set
-- add_index(:reports, [:action_taken_by_account_id], {:name=>:index_reports_on_action_taken_by_account_id, :algorithm=>:concurrently, :where=>"action_taken_by_account_id IS NOT NULL"})
   -> 0.0052s
== 20220428114902 AddIndexReportsOnActionTakenByAccountId: migrated (0.0067s) =

Migrating to RemoveIpsFromEmailDomainBlocks (20220429101025)
== 20220429101025 RemoveIpsFromEmailDomainBlocks: migrating ===================
[strong_migrations] DANGER: No lock timeout set
-- remove_column(:email_domain_blocks, :ips, :inet, {:array=>true})
   -> 0.0092s
-- remove_column(:email_domain_blocks, :last_refresh_at, :datetime)
   -> 0.0019s
== 20220429101025 RemoveIpsFromEmailDomainBlocks: migrated (0.0131s) ==========

Migrating to ClearEmailDomainBlocks (20220429101850)
== 20220429101850 ClearEmailDomainBlocks: migrating ===========================
== 20220429101850 ClearEmailDomainBlocks: migrated (0.0308s) ==================