Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-7687

Reduce duplication in CreateTables.sql

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None

      CreateTables.sql spells out the full definition of all tables in the schema, which is full of duplicated information that should be factored out.

      This would be particularly amenable to core entities: The necessary information to store for work, e.g., is just

          name                VARCHAR NOT NULL,
          type                INTEGER, -- references work_type.id
          comment             VARCHAR(255) NOT NULL DEFAULT '',
          language            INTEGER  -- references language.id
      

      (possibly even minus type and comment, see next paragraph) - the id, gid, edits_pending and last_updated columns with their associated types and constraints are the same for all core entities, as are the associated foo_gid_redirect tables. Additionally, the currently 121 (soon 144, possibly more) l_foo_bar tables can be derived automatically from this alone.

      Together with the entity information from MBS-7571, the definitions for foo_annotation, foo_type, foo_alias/foo_alias_type, edit_foo and probably some more could be autogenerated.

      Other low-hanging fruit to factor out would be partial dates, date ranges (2× partial date plus ended with its heavy check constraint), and option tree information (parent, child_order).

            Unassigned Unassigned
            chirlu Ulrich Klauer
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package