-
New Feature
-
Resolution: Unresolved
-
Normal
-
None
-
None
In order to add medium attributes (a very popular request, see for example MBS-3993) we should first of all amend the schema to make it possible. Implementation of the feature itself would come later, like with the other entities. The schema should match the one for other entities, so something like:
CREATE TABLE medium_attribute_type ( – replicate (verbose)
id SERIAL, – PK
name VARCHAR(255) NOT NULL,
comment VARCHAR(255) NOT NULL DEFAULT '',
free_text BOOLEAN NOT NULL,
parent INTEGER, – references medium_attribute_type.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid uuid NOT NULL
);
CREATE TABLE medium_attribute_type_allowed_value ( – replicate (verbose)
id SERIAL, – PK
medium_attribute_type INTEGER NOT NULL, – references medium_attribute_type.id
value TEXT,
parent INTEGER, – references medium_attribute_type_allowed_value.id
child_order INTEGER NOT NULL DEFAULT 0,
description TEXT,
gid uuid NOT NULL
);
CREATE TABLE medium_attribute ( – replicate (verbose)
id SERIAL, – PK
medium INTEGER NOT NULL, – references medium.id
medium_attribute_type INTEGER NOT NULL, – references medium_attribute_type.id
medium_attribute_type_allowed_value INTEGER, – references medium_attribute_type_allowed_value.id
medium_attribute_text TEXT
CHECK (
(medium_attribute_type_allowed_value IS NULL AND medium_attribute_text IS NOT NULL)
OR
(medium_attribute_type_allowed_value IS NOT NULL AND medium_attribute_text IS NULL)
)
);