Last active
March 15, 2017 17:06
-
-
Save garyharan/b66478ee7cf1e03145d2b279888d3362 to your computer and use it in GitHub Desktop.
Speed up tests marginally
This file contains hidden or 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
# ... | |
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