guides
guides copied to clipboard
DatabaseCleaner setup doesn't work with SQLite
When following persistence setup with ROM in the getting started guide, the database cleaner setup shown doesn't automatically work with SQLite. I know the guides are showing instructions for Postgres, but for simplicity I wanted to use SQLite, and it would be great if everything still worked 👌🏻
Concretely, I have the database URL set to sqlite://db/test.sqlite3 in tests, and I'm getting the following error:
DatabaseCleaner::Safeguard::Error::RemoteDatabaseUrl:
ENV['DATABASE_URL'] is set to a remote URL. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards
It appears that DatabaseCleaner is falsely detecting the SQLite database URL as "remote", because it doesn't see any localhost or 127.0.0.1, even though it's in fact local.
See the relevant documentation for DatabaseCleaner.