module ActiveRecord::Sharding::DatabaseTasks::TasksForSingleConnection
Public Instance Methods
create(connection_name)
click to toggle source
# File lib/active_record/sharding/database_tasks.rb, line 149 def create(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] ActiveRecord::Tasks::DatabaseTasks.create(configuration) ActiveRecord::Base.establish_connection(configuration) end
drop(connection_name)
click to toggle source
# File lib/active_record/sharding/database_tasks.rb, line 155 def drop(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] ActiveRecord::Tasks::DatabaseTasks.drop configuration end
execute(connection_name, sql)
click to toggle source
# File lib/active_record/sharding/database_tasks.rb, line 160 def execute(connection_name, sql) configuration = ActiveRecord::Base.configurations[connection_name] ActiveRecord::Base.establish_connection(configuration).connection.execute sql end
load_schema(connection_name)
click to toggle source
# File lib/active_record/sharding/database_tasks.rb, line 165 def load_schema(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] case when ar5? ActiveRecord::Tasks::DatabaseTasks.load_schema configuration, :ruby when ar42? || ar417_above? ActiveRecord::Tasks::DatabaseTasks.load_schema_for configuration, :ruby when ar41? ActiveRecord::Base.establish_connection configuration ActiveRecord::Tasks::DatabaseTasks.load_schema :ruby else raise "This version of ActiveRecord is not supported: v#{ActiveRecord::VERSION::STRING}" end end