I would like to use Class Table Inheritance (CTI). In standard SQL (without the assistance of Ecto), I would create the base class as its own table, then create a separate table for each derived class with its independent properties as additional columns.
I tried doing this with Ecto but it seems that if you use “belongs_to” you must also use “has_one” on the other side of the association. The “belongs_to” side of things was easy to resolve, since the base class is the same type (schema?) in all cases, but on the other side, the “has_one” can reference more than one type.
How can I resolve this?