MBS-14092: Add support for series of series #3712
MBS-14092: Add support for series of series #3712mwiencek merged 7 commits intometabrainz:schema-change-2026-q2from
Conversation
1fda310 to
b1135b0
Compare
| sub reorder_for_entities { | ||
| my ($self, $type, @ids) = @_; | ||
|
|
||
| $type = $type eq 'series' ? 'series_part' : $type; |
There was a problem hiding this comment.
$type is also used for the table name, so this looks like an error
There was a problem hiding this comment.
Good point - seems I never caught it because we don't actually use this at the moment anyway for series (nor artists or works). Not sure if we should also call reorder_for_entities on those entities' update methods?
There was a problem hiding this comment.
Yeah, I'm pretty sure this should run at least when the entity name changes, since that's potentially used for sorting; see e.g. the after update subroutine in Data::ReleaseGroup.
There was a problem hiding this comment.
Seems sensible. I added all of those in an extra commit (and rebased this).
| -------------------------------------------------------------------------------- | ||
| SELECT '20260121-mbs-14092.sql'; | ||
|
|
||
| \set SERIES_PART_OF_SERIES_ID '1301' |
There was a problem hiding this comment.
This ID is already used by event-url fanpage. Can we avoid hardcoding this and just do (SELECT id FROM link_type WHERE gid = :SERIES_PART_OF_SERIES_GID) instead?
There was a problem hiding this comment.
Just make sure to do SELECT setval('link_type_id_seq', (SELECT MAX(id) FROM link_type)); first.
There was a problem hiding this comment.
I see you also require using the row ID in the source code. Would you be able to add the link type today, in production, with an empty description for now so that it's disabled? (Then set the description in the upgrade script.)
The relationship type has been added in production to ensure that the ID and GID are static and known. The description is empty to ensure it is disabled until this patch is deployed. This will update the description if the relationship type already exists, and otherwise add the type and associated data.
We need some specialcasing in Data::Series since we generally expect the structure of series views to be one "series" column and one "$entity_type" column, which clearly wouldn't have worked for series of series so we have "series_part" instead of the entity type. Similarly, some places needed changes to understand that a series having non-series-series parts is acceptable. We infer the right order for part of series where both sides are series but we know one cannot be the parent (since it does not have a 'series' item_entity_type). This currently disables the JS level item_entity_type check otherwise since it currently doesn't support checking for direction and having an error blocks the change of direction anyway, making it unfixable. It could be improved to disallow changing the order if only one option would be valid. No wrong relationships can be entered, since the Perl layer still rejects them, but in a less user-friendly way.
This was not being called at all for a bunch of entities which have series which should still be reordered when the entity gets renamed, at least.
b8abc34
into
metabrainz:schema-change-2026-q2
Implement MBS-14092
Description
This adds a
series_seriesview, and appropriate series types (“Series series” and “Series award”).We need to have two different column names in the view since we cannot call both
series, I went withseries_part. Related to that, we need some specialcasing inData::Series, since we generally expect the structure of series views to be oneseriescolumn and one$entity_typecolumn but we need to special-case it toseries_partfor series.Similarly, some places needed changes to understand that a series having non-series-series parts is acceptable.
We infer the right order for part of series where both sides are series but we know one cannot be the parent (since it does not have a
'series'item_entity_type).This currently disables the JS level
item_entity_typecheck otherwise since it currently doesn't support checking for direction and having an error blocks the change of direction anyway, making it unfixable. It could be improved to disallow changing the order if only one option would be valid. No wrong relationships can be entered, since the Perl layer still rejects them, but in a less user-friendly way.Testing
Manually so far, by: