My dev environment is my MacBook and my prod environment is on Fly with a Postgres database I have configured via Fly.io.
I cannot run mix tasks on my Fly.io setup because it is working with releases.
I have a lib/myapp/release.ex file which runs Ecto migrations for me when I deploy to prod.
But I’m still in heavy learning/development mode overall, so my prod environment is not really production and I have no users – it is better thought of as a staging environment.
I’m constantly refactoring my schemas as I learn and experiment, so in development I constantly run mix ecto.reset to drop everything in my database and re-run my migrations from scratch.
But in my prod environment I cannot run mix ecto.reset. I could just add a migration that drops everything, but I’d rather not end up with hundreds of migrations before arriving at my final starting point.
So how can I add code to my release.ex module to just drop everything and start from scratch every time I deploy to production? Once I’m ready to actually keep my data around and get some users I’ll obviously remove the code that drops all the data every time I deploy.