Proposal:Alias Types

From MusicBrainz Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The proposed changes to the alias system are to add type, sort name, begin date, end date and a primary flag to aliases.

Types

Types let us store what the alias actually represents. The list of initial types is:

  • Legal name lets us store the artist's legal name without always having to create a new artist (see current guidelines)
  • Performance name (perhaps not the best name) lets us say which aliases were actually used by the artist.
  • Search hint lets us mark aliases which only function as search hints, e.g. typos and misspellings, and can otherwise be ignored. Search hints would not be able to have sort names, dates, locales or the primary flag.

Sort name

Sort name lets us say how each of these names should be sorted (this is particularly useful for non-latin scripts).

Dates

Begin and end dates let us store the date range when the name was used.

Primary flag

Instead of only allowing each locale to be used once, we would have a primary flag. The primary flag lets us mark which of the aliases is considered the primary name for a locale.

Tickets

Geeky stuff

Since this ended up being written as pseudo-SQL anyway, here it is as real SQL:

CREATE TABLE artist_alias_type (
	id SERIAL,
	name VARCHAR(255) NOT NULL
);

ALTER TABLE artist_alias_type ADD CONSTRAINT artist_alias_type_pkey PRIMARY KEY (id);

ALTER TABLE artist_alias ADD 
	sort_name INTEGER NOT NULL, -- references artist_name.id
	begin_date_year SMALLINT,
	begin_date_month SMALLINT,
	begin_date_day SMALLINT,
	end_date_year SMALLINT,
	end_date_month SMALLINT,
	end_date_day SMALLINT,
	type INTEGER, -- references artist_alias_type.id
	primary BOOLEAN NOT NULL DEFAULT FALSE;

ALTER TABLE artist_alias
	ADD CONSTRAINT artist_alias_fk_type
	FOREIGN KEY (type)
	REFERENCES artist_alias_type(id);

ALTER TABLE artist_alias
	ADD CONSTRAINT artist_alias_fk_sort_name
	FOREIGN KEY (sort_name)
	REFERENCES artist_name(id);

INSERT INTO artist_alias_type (id, name) VALUES
	(1, 'legal name'),
	(2, 'performance name'),
	(3, 'search hint');

Constraints not yet written in SQL:

  • Search hints should not have dates, sortnames, locales or the primary flag
  • For each type/locale combo, only one alias can be selected as primary (this replaces the existing constraint that only permits each locale to be used once)