abartov / bybeconv

Project Ben-Yehuda's content management system.
https://benyehuda.org/
Other
10 stars 5 forks source link

Refactor InvolvedAuthorities to use polymorphic relation. #417

Closed damisul closed 5 days ago

damisul commented 3 months ago

When I reworked InvolvedAuthorities, I only expected it to be linked with Expressions or Works. So I've added separate columns to work_id and expression_id.

Now we added collection_id there. And probably in future we'll want to reuse it for something else.

If so I believe it would be better to use polymorphic relation with two columns: item_id, item_type instead of work_id/expression_id/collection_id.

So it will be kind of rollbacking of part of my changes, but I believe it should be easy enough.

abartov commented 3 months ago

Yes, this makes sense.