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



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

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

#exec_migration_with_turntable(*args) ⇒ Object



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

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

#target_shard?(shard_name) ⇒ Boolean

Returns:

  • (Boolean)


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

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