FEATURE: Allow pausing of restore before DB migration and uploads are restored (#30269)

This can be helpful if you need to fix problems in the DB before the DB gets migrated as well as before uploads are restored.
This commit is contained in:
Gerhard Schlager
2024-12-16 12:50:08 +01:00
committed by GitHub
parent 04ba5baec0
commit 6b3e28216c
3 changed files with 48 additions and 5 deletions

View File

@ -16,7 +16,7 @@ module BackupRestore
@current_db = current_db
end
def restore(db_dump_path)
def restore(db_dump_path, interactive = false)
BackupRestore.move_tables_between_schemas(MAIN_SCHEMA, BACKUP_SCHEMA)
@db_dump_path = db_dump_path
@ -24,6 +24,7 @@ module BackupRestore
create_missing_discourse_functions
restore_dump
pause_before_migration if interactive
migrate_database
reconnect_database
@ -136,6 +137,16 @@ module BackupRestore
].compact.join(" ")
end
def pause_before_migration
puts ""
puts "Attention! Pausing restore before migrating database.".red.bold
puts "You can work on the restored database in a separate Rails console."
puts ""
puts "Press any key to continue with the restore.".bold
puts ""
STDIN.getch
end
def migrate_database
log "Migrating the database..."