Not sure if we have explored this before, but Rails can automatically maintain test databse schema with
ActiveRecord::Migration.maintain_test_schema! (method definition, in
rails/test_help, in latest
rspec/rails helper generator)
Here is a diff to incorporate it into Discourse’s
However, it fails on my Docker-based development setup:
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: must be owner of database discourse_test
This is because
db:test:prepare, and tries to drop the test database first, to which (I believe) the
discourse user on Docker-based setup does not have access.
Could someone with a native dev setup could try it out? If it works, maybe the change is worth considering?