Ruby on Rails has a
rails db:prepare command. It migrates the database, if it exists, else it creates it, migrates it (or loads the schema, but that’s only a subtle difference) and seeds it. See Rails 6 adds rails db:prepare to migrate or setup a database - BigBinary Blog for more info.
I am wondering: does Phoenix have a similar command?
I know that a freshly generated Phoenix 1.7 app defines a mix alias
ecto.setup in the
mix.exs file, which does
"ecto.create", "ecto.migrate", "run priv/repo/seeds.exs", that it is the latter part of what Rails does. But this is neither checking for db existence first, nor is it idempotent.