How to delete/drop table?

No, you have to create a new migration, I named it DropPosts here but you can use any name you like.

To generate migration type the following command in terminal. More about it here mix ecto.gen.migration — Ecto SQL v3.6.1

mix ecto.gen.migration drop_posts

And then add change function to the migration file

defmodule Blogs.Repo.Migrations.DropPosts do
  use Ecto.Migration

  def change do
    drop table("posts")
  end
end
2 Likes