Module: Octopus::Migrator::ClassMethods
- Defined in:
- lib/octopus/migration.rb
Instance Method Summary collapse
- #down_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
- #migrate_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
- #rollback_with_octopus(migrations_paths, steps = 1) ⇒ Object
- #run_with_octopus(direction, migrations_paths, target_version) ⇒ Object
- #up_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
Instance Method Details
#down_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
174 175 176 177 178 179 180 181 |
# File 'lib/octopus/migration.rb', line 174 def down_with_octopus(migrations_paths, target_version = nil, &block) return down_without_octopus(migrations_paths, target_version, &block) unless connection.is_a?(Octopus::Proxy) return down_without_octopus(migrations_paths, target_version, &block) unless connection.current_shard.to_s == Octopus.master_shard.to_s connection.send_queries_to_multiple_shards(connection.shard_names) do down_without_octopus(migrations_paths, target_version, &block) end end |
#migrate_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/octopus/migration.rb', line 157 def migrate_with_octopus(migrations_paths, target_version = nil, &block) return migrate_without_octopus(migrations_paths, target_version, &block) unless connection.is_a?(Octopus::Proxy) connection.send_queries_to_multiple_shards(connection.shard_names) do migrate_without_octopus(migrations_paths, target_version, &block) end end |
#rollback_with_octopus(migrations_paths, steps = 1) ⇒ Object
191 192 193 194 195 196 197 |
# File 'lib/octopus/migration.rb', line 191 def rollback_with_octopus(migrations_paths, steps = 1) return rollback_without_octopus(migrations_paths, steps) unless connection.is_a?(Octopus::Proxy) connection.send_queries_to_multiple_shards(connection.shard_names) do rollback_without_octopus(migrations_paths, steps) end end |
#run_with_octopus(direction, migrations_paths, target_version) ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/octopus/migration.rb', line 183 def run_with_octopus(direction, migrations_paths, target_version) return run_without_octopus(direction, migrations_paths, target_version) unless connection.is_a?(Octopus::Proxy) connection.send_queries_to_multiple_shards(connection.shard_names) do run_without_octopus(direction, migrations_paths, target_version) end end |
#up_with_octopus(migrations_paths, target_version = nil, &block) ⇒ Object
165 166 167 168 169 170 171 172 |
# File 'lib/octopus/migration.rb', line 165 def up_with_octopus(migrations_paths, target_version = nil, &block) return up_without_octopus(migrations_paths, target_version, &block) unless connection.is_a?(Octopus::Proxy) return up_without_octopus(migrations_paths, target_version, &block) unless connection.current_shard.to_s == Octopus.master_shard.to_s connection.send_queries_to_multiple_shards(connection.shard_names) do up_without_octopus(migrations_paths, target_version, &block) end end |