Approach #2: Use an Abstract Schema

Learn how to implement polymorphism in Ecto using separate tables, and one abstract schema.

Create separate notes tables

This approach might not be entirely intuitive at first glance, but it’s worth exploring as it reveals some interesting features about schemas that we haven’t looked at before. It might also be the right solution for our application.

With this approach, we’ll create separate notes tables for each of the other tables we’re associating with. We’ll have one notes table for artists, another for albums, and so on. Here’s how we might write the migration:

Get hands-on with 1200+ tech skills courses.