The linked article suggests an interesting way to speed up tests of Rails + Postgres apps:
PostgreSQL allows the creation of “unlogged” tables, which do not record data in the PostgreSQL Write-Ahead Log Show archive.org snapshot . This can make the tables faster, but significantly increases the risk of data loss if the database crashes. As a result, this should not be used in production environments. If you would like all created tables to be unlogged in the test environment you can add the following to your test.rb file:
# config/environments/test.rb
ActiveSupport.on_load(:active_record_postgresqladapter) do
self.create_unlogged_tables = true
end
To test the integration, commit the code snipped to your repository, then run your tests and re-record their parallel runtime.
Note
The statement only affects newly created tables. You and everyone on the project might need to re-recreate their test databases like so:
bundle exec rails parallel:drop && bundle exec rails parallel:prepare