aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/database_configurations/hash_config.rb
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-08-31 10:53:20 -0400
committerEileen Uchitelle <eileencodes@gmail.com>2018-08-31 10:53:20 -0400
commit8737dffce73a37dff073dfe0af8931efd08632c5 (patch)
tree203dacc96afb07fd766ef1b3851c93ec31a5f2c1 /activerecord/lib/active_record/database_configurations/hash_config.rb
parent2fd997c111b3d2921d011d8023314dbfc2dec317 (diff)
downloadrails-8737dffce73a37dff073dfe0af8931efd08632c5.tar.gz
rails-8737dffce73a37dff073dfe0af8931efd08632c5.tar.bz2
rails-8737dffce73a37dff073dfe0af8931efd08632c5.zip
Add replica? check to DatabaseConfig
Checks if the config has a "replica" key, if so the configuration is for a replica database. This is useful for excluding replicas from the configurations list when creating the rake tasks or running rake tasks. For example, we don't want to create the primary and primary_readonly. They're the same database.
Diffstat (limited to 'activerecord/lib/active_record/database_configurations/hash_config.rb')
-rw-r--r--activerecord/lib/active_record/database_configurations/hash_config.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/database_configurations/hash_config.rb b/activerecord/lib/active_record/database_configurations/hash_config.rb
index 2ee218c730..249107ebeb 100644
--- a/activerecord/lib/active_record/database_configurations/hash_config.rb
+++ b/activerecord/lib/active_record/database_configurations/hash_config.rb
@@ -31,6 +31,10 @@ module ActiveRecord
super(env_name, spec_name)
@config = config
end
+
+ def replica?
+ config["replica"]
+ end
end
end
end