mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Use proper ActiveRecord method in import scripts
`ActiveRecord::Base.connection_config` has been deprecated since Rails 6.1 and was completely removed from Rails 7. Instead we need to use `ActiveRecord::Base.connection_db_config.configuration_hash`. Import scripts were forgotten when we did the Rails 7 upgrade, this patch fixes them.
This commit is contained in:
parent
c05dc01fe9
commit
ab6ca78486
@ -74,7 +74,7 @@ class BulkImport::Base
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
charset = ENV["DB_CHARSET"] || "utf8"
|
charset = ENV["DB_CHARSET"] || "utf8"
|
||||||
db = ActiveRecord::Base.connection_config
|
db = ActiveRecord::Base.connection_db_config.configuration_hash
|
||||||
@encoder = PG::TextEncoder::CopyRow.new
|
@encoder = PG::TextEncoder::CopyRow.new
|
||||||
@raw_connection = PG.connect(dbname: db[:database], port: db[:port])
|
@raw_connection = PG.connect(dbname: db[:database], port: db[:port])
|
||||||
@uploader = ImportScripts::Uploader.new
|
@uploader = ImportScripts::Uploader.new
|
||||||
|
@ -18,7 +18,7 @@ class BulkImport::DiscourseMerger < BulkImport::Base
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
db_password = ENV["DB_PASS"] || 'import_password'
|
db_password = ENV["DB_PASS"] || 'import_password'
|
||||||
local_db = ActiveRecord::Base.connection_config
|
local_db = ActiveRecord::Base.connection_db_config.configuration_hash
|
||||||
@raw_connection = PG.connect(dbname: local_db[:database], host: 'localhost', port: local_db[:port], user: 'postgres', password: db_password)
|
@raw_connection = PG.connect(dbname: local_db[:database], host: 'localhost', port: local_db[:port], user: 'postgres', password: db_password)
|
||||||
|
|
||||||
@source_db_config = {
|
@source_db_config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user