This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This goes at global scope (remove it from your other groups) | |
gem 'pry-rails', require: false | |
gem 'pry-byebug', require: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful for tracking the progress of a large batch job | |
# Pass in 'counter', a lambda that returns an integer | |
# This will periodically call the counter, | |
# track the rate counted things are consumed (or produced) | |
# and make a prediction about when it completes | |
# options: | |
# - divisor: how many times per minute to sample, default 6 (every ten seconds) | |
# - rolling_window: how many rate samples to average when making predictions (default 10) | |
# - target: what value are we aiming for, default 0 (consuming a queue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Have your health checker execute this | |
require './liveness_monitor' | |
puts LivenessMonitor.new.status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH column_info AS ( | |
SELECT t.relname AS table_name, c.attname AS column_name, c.atttypid, c.attlen AS length, y.typname AS type | |
, pg_get_expr(adbin, adrelid) AS default | |
, (regexp_matches(pg_get_expr(adbin, adrelid), 'nextval..(.*).::regclass'))[1] AS sequencename | |
FROM pg_class t | |
LEFT OUTER JOIN pg_attribute c ON c.attrelid = t.oid | |
LEFT OUTER JOIN pg_type y ON y.oid = c.atttypid | |
LEFT OUTER JOIN pg_attrdef d ON t.oid = d.adrelid AND d.adnum = c.attnum | |
WHERE pg_get_expr(adbin, adrelid) LIKE '%nextval%' | |
), |
OlderNewer