discourse/lib/backup_restore
Gerhard Schlager 07ff21d045
FIX: Restoring backup could fail due to missing discourse_functions (#29332)
Database dumps sometimes reference functions in the `discourse_functions` schema. It's possible that some of these functions have been dropped in a newer version of Discourse. In that case, restoring an older backup will fail with a `ERROR:  function discourse_functions.something_something() does not exist` error. The restore functionality contains a workaround for that problem, but it didn't work with functions created in plugin migrations.

This commit adds support for temporarily creating missing `discourse_functions` from plugins. And it adds a simple check if the DB migration file even contains the required `DROPPED_TABLES` or `DROPPED_COLUMNS` constant. We don't need to create an instance of the DB migration class unless one of those constants is used. This makes the restore slightly faster and works around a problem with migrations that execute without `up` or `down` methods (e.g. `BackfillChatChannelAndThreadLastMessageIdsPostMigrate`).
2024-10-22 16:13:01 +02:00
..
backup_file_handler.rb DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
backup_store.rb FEATURE: Delete backups based on time window (#24296) 2023-12-13 13:00:27 -05:00
backuper.rb DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
database_restorer.rb FIX: Restoring backup could fail due to missing discourse_functions (#29332) 2024-10-22 16:13:01 +02:00
factory.rb
local_backup_store.rb FEATURE: Delete backups based on time window (#24296) 2023-12-13 13:00:27 -05:00
logger.rb
meta_data_handler.rb
restorer.rb
s3_backup_store.rb DEV: Remove logical OR assignment of constants (#29201) 2024-10-16 10:09:07 +08:00
system_interface.rb
uploads_restorer.rb