Module: ActiveRecord::Turntable::Migration::MigrationContext

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_record/turntable/migration.rb

Instance Method Summary collapse

Instance Method Details

#down(target_version = nil) ⇒ Object



110
111
112
113
114
115
116
117
118
119
# File 'lib/active_record/turntable/migration.rb', line 110

def down(target_version = nil)
  result = super

  ActiveRecord::Tasks::DatabaseTasks.each_current_turntable_cluster_connected(current_environment) do |name, configuration|
    puts "[turntable] *** Migrating database: #{configuration['database']}(Shard: #{name})"
    super(target_version)
  end

  result
end

#run(direction, target_version) ⇒ Object



121
122
123
124
125
126
127
128
129
130
# File 'lib/active_record/turntable/migration.rb', line 121

def run(direction, target_version)
  result = super

  ActiveRecord::Tasks::DatabaseTasks.each_current_turntable_cluster_connected(current_environment) do |name, configuration|
    puts "[turntable] *** Migrating database: #{configuration['database']}(Shard: #{name})"
    super(target_version)
  end

  result
end

#up(target_version = nil) ⇒ Object



99
100
101
102
103
104
105
106
107
108
# File 'lib/active_record/turntable/migration.rb', line 99

def up(target_version = nil)
  result = super

  ActiveRecord::Tasks::DatabaseTasks.each_current_turntable_cluster_connected(current_environment) do |name, configuration|
    puts "[turntable] *** Migrating database: #{configuration['database']}(Shard: #{name})"
    super(target_version)
  end

  result
end