mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
f69dacf979
Simplified flow of restore is like that ``` migrate_database reconnect extract_uploads ``` Problem with incorrect current database started with this fix https://github.com/discourse/discourse/commit/025d4ee91f4 Dump task is reconnecting to default database https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake#L429 And then, we are trying to reconnect to the original database with that code: ``` def reconnect_database log "Reconnecting to the database..." RailsMultisite::ConnectionManagement::establish_connection(db: @current_db) end ``` This reconnect is not switching us back to correct database because of that check https://github.com/discourse/rails_multisite/blob/master/lib/rails_multisite/connection_management.rb#L181 Basically, it finds existing handler and it thinks that we are connected to correct DB and this step can be skipped. To solve it, we can reload RailsMultisite::ConnectionManagement which creates a new instance of that class https://github.com/discourse/rails_multisite/blob/master/lib/rails_multisite/connection_management.rb#L38 |
||
---|---|---|
.. | ||
backup_restore | ||
compression | ||
content_security_policy | ||
i18n | ||
seed_data | ||
site_settings | ||
webauthn | ||
browser_detection_spec.rb | ||
content_security_policy_spec.rb | ||
db_helper_spec.rb | ||
encodings_spec.rb | ||
introduction_updater_spec.rb | ||
mini_sql_multisite_connection_spec.rb | ||
search_spec.rb | ||
theme_javascript_compiler_spec.rb | ||
upload_creator_spec.rb | ||
upload_recovery_spec.rb |