Skip to content

MBS-14092: Add support for series of series #3712

Merged
mwiencek merged 7 commits intometabrainz:schema-change-2026-q2from
reosarevok:MBS-14092
May 4, 2026
Merged

MBS-14092: Add support for series of series #3712
mwiencek merged 7 commits intometabrainz:schema-change-2026-q2from
reosarevok:MBS-14092

Conversation

@reosarevok
Copy link
Copy Markdown
Member

@reosarevok reosarevok commented Jan 21, 2026

Implement MBS-14092

Description

This adds a series_series view, 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 with series_part. Related to that, 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 but we need to special-case it to series_part for 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_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.

Testing

Manually so far, by:

  • Adding a series award series.
  • Ensuring you can add other series to it
  • Ensuring the series can be of any type
  • Ensuring the right order is picked by default when only one order makes sense
  • Ensuring the part series shows the link back to the containing series:
image
  • Ensuring the display of the series of series makes sense:
image

@reosarevok reosarevok added this to the Schema change 2026 Q2 milestone Jan 21, 2026
@reosarevok reosarevok added the New feature Non urgent new stuff label Jan 21, 2026
@reosarevok reosarevok force-pushed the MBS-14092 branch 3 times, most recently from 1fda310 to b1135b0 Compare January 26, 2026 16:56
@mwiencek mwiencek added the Reviewing Pull requests that the team is prioritizing reviewing. label Apr 8, 2026
Comment thread lib/MusicBrainz/Server/Data/Series.pm Outdated
sub reorder_for_entities {
my ($self, $type, @ids) = @_;

$type = $type eq 'series' ? 'series_part' : $type;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$type is also used for the table name, so this looks like an error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible. I added all of those in an extra commit (and rebased this).

@reosarevok reosarevok changed the base branch from master to schema-change-2026-q2 April 23, 2026 11:27
@reosarevok reosarevok changed the title [WIP] MBS-14092: Add support for series of series MBS-14092: Add support for series of series Apr 23, 2026
@reosarevok reosarevok marked this pull request as ready for review April 23, 2026 11:35
--------------------------------------------------------------------------------
SELECT '20260121-mbs-14092.sql';

\set SERIES_PART_OF_SERIES_ID '1301'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make sure to do SELECT setval('link_type_id_seq', (SELECT MAX(id) FROM link_type)); first.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

reosarevok added 7 commits May 4, 2026 18:52
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.
@mwiencek mwiencek merged commit b8abc34 into metabrainz:schema-change-2026-q2 May 4, 2026
10 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New feature Non urgent new stuff Reviewing Pull requests that the team is prioritizing reviewing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants