Skip to content

Instantly share code, notes, and snippets.

@garyharan
Last active March 15, 2017 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garyharan/b66478ee7cf1e03145d2b279888d3362 to your computer and use it in GitHub Desktop.
Save garyharan/b66478ee7cf1e03145d2b279888d3362 to your computer and use it in GitHub Desktop.
Speed up tests marginally
# ...
config.before(:suite) do
connection = ActiveRecord::Base.connection
query = connection.tables.map { |t| "ALTER TABLE #{t} SET UNLOGGED;" }.join("\n")
# one line for each foreign_key at the end of your schema.rb
ActiveRecord::Migration.remove_foreign_key "reports", "users"
connection.execute(query)
end
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment