module MixedGauge::DatabaseTasks::TasksForSingleConnection
Create, drop, load_schema
for single connection config.
Public Instance Methods
create(connection_name)
click to toggle source
@param [String] connection_name
# File lib/mixed_gauge/database_tasks.rb, line 153 def create(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] ActiveRecord::Tasks::DatabaseTasks.create(configuration) # Re-configure using configuration with database ActiveRecord::Base.establish_connection(configuration) end
drop(connection_name)
click to toggle source
@param [String] connection_name
# File lib/mixed_gauge/database_tasks.rb, line 161 def drop(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] ActiveRecord::Tasks::DatabaseTasks.drop(configuration) end
load_schema(connection_name)
click to toggle source
@param [String] connection_name
# File lib/mixed_gauge/database_tasks.rb, line 167 def load_schema(connection_name) configuration = ActiveRecord::Base.configurations[connection_name] if ar5? ActiveRecord::Tasks::DatabaseTasks.load_schema(configuration, :ruby) elsif ar42? || ar417_above? ActiveRecord::Tasks::DatabaseTasks.load_schema_for(configuration, :ruby) elsif 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