diff options
author | ThibG <thib@sitedethib.com> | 2020-11-20 15:11:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-20 15:11:43 +0100 |
commit | 24696458bf22c8529b49f89b2791e3e07583b7e0 (patch) | |
tree | 65e4711917b343a38c6e9f498f8d36e71dcde7c4 /lib/tasks/db.rake | |
parent | db01f8b942b72eaa2eacbb144261b002f8079c9c (diff) | |
parent | 3281c9b4c0935a9296e0ea5f359243d732605832 (diff) |
Merge pull request #1467 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib/tasks/db.rake')
-rw-r--r-- | lib/tasks/db.rake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index b76e90131..199155107 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -48,6 +48,17 @@ namespace :db do end end + task :post_migration_hook do + at_exit do + 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.' + Rails.logger.warn 'WARNING: See https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/#am-i-affected' + end + end + end + + Rake::Task['db:migrate'].enhance(['db:post_migration_hook']) + # Before we load the schema, define the timestamp_id function. # Idiomatically, we might do this in a migration, but then it # wouldn't end up in schema.rb, so we'd need to figure out a way to |