Module: ActiveRecord::Turntable::Migration

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

Defined Under Namespace

Modules: CommandRecorder, Migrator, SchemaStatementsExt, ShardDefinition

Instance Method Summary collapse

Instance Method Details

#announce_with_turntable(message) ⇒ Object



41
42
43
# File 'lib/active_record/turntable/migration.rb', line 41

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

#exec_migration_with_turntable(*args) ⇒ Object



45
46
47
# File 'lib/active_record/turntable/migration.rb', line 45

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

#target_shard?(shard_name) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/active_record/turntable/migration.rb', line 37

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