Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'net/http'
require 'base64'
require 'cgi'
require 'time'
require 'json'
###### CO-OP CONNECTIONS AND METHODS ######
Do you have a problem making use of a Rails' default migration generation
logic's inclusion of your test_helper?
require 'test_helper'
Do you have to replace it with?
require File.dirname(__FILE__) + '/../test_helper'
Manually? Every time? Annoyed?
# This is a mechanism we use often in our migrations. When we have a migration
# that hits every record of a large table, this looping mechanism takes the
# bite away from the migration. This allows us to be transactional in our
# migration while avoiding aggressive locking of the table. Ultimately
# allowing us to do migratory deployments even more frequently during high
# usage areas of the day.
#
# Further, some long migrations that we'd run over a weekend may exceed the
# max transaction time set on our MySQL server. Running smaller transactions
# avoids this sensible restriction.