FIX: Create PostgreSQL extensions before migrating (#16158)

Enabled extensions are not saved in backups and thus not created when
restoring a newer backup (that has a new extension) to an old site
(that does not have the migration).
This commit is contained in:
Bianca Nenciu 2022-05-11 09:48:03 +03:00 committed by GitHub
parent 9b420eb6e3
commit 631bfb2a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,6 +215,8 @@ 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}" }
ActiveRecord::Tasks::DatabaseTasks.migrate
if !Discourse.is_parallel_test?