I came searching for the same information. As josevalim stated, the docs cover this pretty well and essentially go over some of the different SQL iheritance options but with information on how to implement with Elixir/Ecto.
To understand the solution I would first research SQL inheritance types (or just read this post: How to handle schemas polymorphism in Phoenix?)
Then go over to the docs to understand how to implement some of the “recommended” types:
https://hexdocs.pm/ecto/Ecto.Schema.html#belongs_to/3-polymorphic-associations