I have a use-case, where I cannot rename my test-db. Because of this the built-in db-provider uses the wrong database_url, because of the “test”-suffix. How to handle such cases?
I have found the following workaround, but I think we need something else here, don’t you? WDYT?
# slices/my_slice/config/providers/db.rb
MySlice::Slice.configure_provider :db do
@database_url = "mysql2://blabla"
end
I’m curious, what is your use-case that prevents you from changing the test db? It should generally be considered ephemeral.
The motivation for using this Hanami::DB::Testing.database_url interface is to provide an extension point for a break-glass scenario like this. We didn’t think this would come up often enough to merit configuration, but you can monkeypatch this method call to change the behavior.
module Hanami::DB::Testing
def self.database_url(url) = url
end