Hey fellow alchemists,
I was delighted to see that an sqlite3 adapter has indeed been developed since I tried phoenix and ecto last, so I decided to give it another try.
Sadly, with a phoenix liveview application, using the phx.gen.live
generator, some generated tests always fail – specifically, the liveview tests deleting and updating items in a list always fail.
I tracked down the issue to the documented problem with the Ecto sandbox here.
I wish to just use the normal application repo with :memory:
databases which can be destroyed and spun up relatively fast. I already found information regarding after_connect
. I do not care enough about performance for this.
How do I define a new TestCase (like ConnCase
) without the sandbox? The goal is to make the failing tests succeed and exclude them
(If there was another way to make the generated tests run with sqlite3 with the sandbox enabled, I would be happy to be told how.)
The following creates a test project exhibiting the problem.
mix phx.new --database sqlite3 --live throwaway
cd throwaway
# create some entity in the db with associates liveviews
mix phx.gen.live Things Thing thing thingvalue:integer thingdescription:string
# copy routes into router.ex
mix test
Thanks for reading!
Because PostgreSQL always seems to be commented on: sqlite3 is going to be the production database, not some development crutch. I have been working with sqlite3 for almost 15 years, I am comfortable with it in this case. I know PostgreSQL well (and I love it too), but I do not wish to install, backup, and maintain another database cluster.