module ActiveRecord::ShardFor::DatabaseTasks
Public Instance Methods
ar417_above?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 32 def ar417_above? ar41? && ActiveRecord::VERSION::TINY > 7 end
ar41?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 27 def ar41? ar4? && ActiveRecord::VERSION::MINOR == 1 end
ar42?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 22 def ar42? ar4? && ActiveRecord::VERSION::MINOR == 2 end
ar4?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 17 def ar4? ActiveRecord::VERSION::MAJOR == 4 end
ar5?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 12 def ar5? ActiveRecord::VERSION::MAJOR == 5 end
ar6?()
click to toggle source
@return [Boolean]
# File lib/activerecord/shard_for/database_tasks.rb, line 7 def ar6? ActiveRecord::VERSION::MAJOR == 6 end
cluster_names()
click to toggle source
@private @return [Array<Symbol>]
# File lib/activerecord/shard_for/database_tasks.rb, line 58 def cluster_names ActiveRecord::ShardFor.config.cluster_configs.keys end
clusters()
click to toggle source
@private @return [Array<ActiveRecord::ShardFor::ClusterConfig>]
# File lib/activerecord/shard_for/database_tasks.rb, line 64 def clusters ActiveRecord::ShardFor.config.cluster_configs.values end
exit_with_error()
click to toggle source
For mock-ablity @private
# File lib/activerecord/shard_for/database_tasks.rb, line 77 def exit_with_error exit 1 end
fetch_cluster_config(cluster_name)
click to toggle source
@private @return [ActiveRecord::ShardFor::ClusterConfig] @raise [KeyError]
# File lib/activerecord/shard_for/database_tasks.rb, line 71 def fetch_cluster_config(cluster_name) ActiveRecord::ShardFor.config.fetch_cluster_config(cluster_name) end
info()
click to toggle source
Show information of database sharding config.
# File lib/activerecord/shard_for/database_tasks.rb, line 37 def info puts 'All clusters registered to ActiveRecord::ShardFor' puts clusters.each do |cluster| puts "= Cluster: #{cluster.name} =" cluster.connections.each do |name| puts "- #{name}" end puts end end
to_rake_task(task_name)
click to toggle source
@private @param [String] task_name @return [Rake::Task]
# File lib/activerecord/shard_for/database_tasks.rb, line 52 def to_rake_task(task_name) Rake::Task[task_name] end