mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
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:
@ -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..."
|
||||
|
||||
|
Reference in New Issue
Block a user