Skip to content

A platform for community discussion. Free, open, simple.

FIX: Show error message if extensions cannot be created (#16719)

Bianca Nenciu5165fb638e99
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index 76c5284e996..dcdf90664f2 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -215,7 +215,14 @@ task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args|
raise "Migration #{migrations.last.version} is timestamped in the future" if migrations.last.version > now_timestamp
raise "Migration #{migrations.first.version} is timestamped before the epoch" if migrations.first.version < epoch_timestamp
- %i[pg_trgm unaccent].each { |extension| DB.exec "CREATE EXTENSION IF NOT EXISTS #{extension}" }
+ %i[pg_trgm unaccent].each do |extension|
+ begin
+ DB.exec "CREATE EXTENSION IF NOT EXISTS #{extension}"
+ rescue => e
+ STDERR.puts "Cannot enable database extension #{extension}"
+ STDERR.puts e
+ end
+ end
ActiveRecord::Tasks::DatabaseTasks.migrate