Module: SafePgMigrations::Helpers::BlockingActivityFormatter

Included in:
BlockingActivityLogger
Defined in:
lib/safe-pg-migrations/helpers/blocking_activity_formatter.rb

Instance Method Summary collapse

Instance Method Details

#log_queries(queries) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/safe-pg-migrations/helpers/blocking_activity_formatter.rb', line 6

def log_queries(queries)
  if queries.empty?
    Logger.say 'Could not find any blocking query.', sub_item: true
  else
    Logger.say "      Statement was being blocked by the following \#{'query'.pluralize(queries.size)}:\n    MESSAGE\n\n    Logger.say '', sub_item: true\n    output_blocking_queries(queries)\n    Logger.say <<~MESSAGE.squish, sub_item: true\n      Beware, some of those queries might run in a transaction. In this case the locking query might be located\n      elsewhere in the transaction\n    MESSAGE\n\n    Logger.say '', sub_item: true\n  end\nend\n".squish, sub_item: true