Page MenuHomePhabricator

Adds a table with namespaces on Tools Labs DB replica
Closed, DuplicatePublic

Description

It would be great to have on DB replica a table for each wiki with namespace ids to namespace name mapping. This data is currently not available in the database, making some joins difficult (example: retrieving the linked pages using the pagelinks table).

This table could have a schema like:

  • namespace_id INT namespace id, primary key
  • namespace_name VARCHAR namespace local name, with a unique? index
  • namespace_canonical VARCHAR namespace canonical name, with a unique? index

This does not handle namespace aliases. It could be done using two ways:

  • add a new namespace_alias table with two columns namespace_alias_id and namespace_alias_name. This table should maybe be also populated by namespaces usual and canonical names to do the conversion from all possible names easier.
  • add extra rows to the namespace table and an extra boolean column stating if it is an alias and not. The alias rows would have namespace_name set to the alias.

These data could be retrieved from the API using: https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces