Fix post-migration warning about index corruption being too scary (#15223)

main
Eugen Rochko 2020-11-27 15:41:43 +01:00 committed by GitHub
parent 1e89e2ed98
commit ec0edf74d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -51,8 +51,11 @@ namespace :db do
task :post_migration_hook do task :post_migration_hook do
at_exit do at_exit do
unless %w(C POSIX).include?(ActiveRecord::Base.connection.execute('SELECT datcollate FROM pg_database WHERE datname = current_database();').first['datcollate']) unless %w(C POSIX).include?(ActiveRecord::Base.connection.execute('SELECT datcollate FROM pg_database WHERE datname = current_database();').first['datcollate'])
Rails.logger.warn 'WARNING: Your database is using an unsafe collation setting, which might result in index corruption.' warn <<~WARNING
Rails.logger.warn 'WARNING: See https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/#am-i-affected' Your database collation is susceptible to index corruption.
(This warning does not indicate that index corruption has occured and can be ignored)
(To learn more, visit: https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/)
WARNING
end end
end end
end end