Module: ActiveRecord::Turntable::Migration

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

Defined Under Namespace

Modules: CommandRecorder, SchemaStatementsExt, ShardDefinition

Instance Method Summary collapse

Instance Method Details

#announce_with_turntable(message) ⇒ Object



39
40
41
# File 'lib/active_record/turntable/migration.rb', line 39

def announce_with_turntable(message)
  announce_without_turntable("#{message} - Shard: #{current_shard}")
end

#exec_migration_with_turntable(*args) ⇒ Object



43
44
45
# File 'lib/active_record/turntable/migration.rb', line 43

def exec_migration_with_turntable(*args)
  exec_migration_without_turntable(*args) if target_shard?(current_shard)
end

#target_shard?(shard_name) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/active_record/turntable/migration.rb', line 35

def target_shard?(shard_name)
  target_shards.blank? or target_shards.include?(shard_name)
end