Sha256: 06e342fb429ac4253aecb5073bfc51f8ccb16b0c63898635f19e78b3a995d868
Contents?: true
Size: 1.01 KB
Versions: 13
Compression:
Stored size: 1.01 KB
Contents
def clean_all_shards() ActiveRecord::Base.using(:master).connection.instance_variable_get(:@shards).keys.each do |shard_symbol| ['schema_migrations', 'users', 'clients', 'cats', 'items', 'keyboards', 'computers', 'permissions_roles', 'roles', 'permissions', 'assignments', 'projects', 'programmers'].each do |tables| ActiveRecord::Base.using(shard_symbol).connection.execute("DELETE FROM #{tables};") end end end def clean_connection_proxy() Thread.current[:connection_proxy] = nil end def migrating_to_version(version, &block) begin ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT, version) yield ensure ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT, version) end end def using_enviroment(enviroment, &block) begin set_octopus_env(enviroment.to_s) clean_connection_proxy() yield ensure set_octopus_env('octopus') clean_connection_proxy() end end def set_octopus_env(env) Octopus.instance_variable_set(:@config, nil) Octopus.stub!(:env).and_return(env) end
Version data entries
13 entries across 13 versions & 1 rubygems