Couldn't drop database using mix ecto.reset on seeds file

Hello! I am taking the Pragmatic Studio course and am in the Live Navigation lesson. They are having me reset my seeds file which is supposed to drop the database, recreate the database, run migrations and replant the seeds. However, when I go to do it, I get the following error:

** (Mix) The database for LiveViewStudio.Repo couldn’t be dropped: ERROR 55006 (object_in_use) database “live_view_studio_dev” is being accessed by other users

There are 10 other sessions using the database.

1 Like

Hey. The most likely cause is that your app is running. Try stopping your app from the console and then running the reset command.

2 Likes

That worked! Thank you.

You’re welcome! Enjoy learning Phoenix.

1 Like

Incase you are running your app ontop of postgres and have

pg_cron

installed, you can stop it from running

or just add --force-drop option to ecto.drop in your ecto.reset alias like below.

  defp aliases do
    [
      ...
      "ecto.reset": ["ecto.drop --force-drop", "ecto.setup"],
      ...
    ]
  end

Reference: mix ecto.drop — Ecto v3.10.1