The Content Relations represent translated/connected/related content (e.g., posts, and terms). Currently, we store the according information in a single table. This table has an ID column (which is not really useful). Also, there are source blog ID and source content ID columns that are (mis)used as a pseudo coposite key. Then there's a self-reference (source blog/content ID equals target blog/content ID), lots of redundancy, and complicated and inefficient queries.
So, the whole Content Relations infrastructure will be refactored.
We will use the following two (as-good-as-can-be normalized) tables to handle content relationships:
{$table_prefix}mlp_relationships
This table will handle the individual relation groups (so-called relationships). Since a post can only be related to another post (and not a term, for instance), the type will be integrated into the relationship itself (and not into a related content entry, see next table).
The (auto-incremented, hence unique) id column will be used as primary key.
{$table_prefix}mlp_content_relations
relationship_id |
site_id |
content_id |
This table handles the individual content elements.
The unique combination (relationship_id,site_id,content_id) will serve as primary key, and, for efficient querying, we will also add the composite key (site_id,content_id).
Why exactly those keys, you ask? Please read this thread on the DBA StackExchange.
The refactoring will be performed as follows:
During or after the refactoring, we will also tackle all open Content Relations issues.
One of the things that are left open for now is how far we will go regarding backwards compatibility. When the time is right, we will discuss this.
The Content Relations represent translated/connected/related content (e.g., posts, and terms). Currently, we store the according information in a single table. This table has an ID column (which is not really useful). Also, there are source blog ID and source content ID columns that are (mis)used as a pseudo coposite key. Then there's a self-reference (source blog/content ID equals target blog/content ID), lots of redundancy, and complicated and inefficient queries.
So, the whole Content Relations infrastructure will be refactored.
We will use the following two (as-good-as-can-be normalized) tables to handle content relationships:
{$table_prefix}mlp_relationshipsidtypeThis table will handle the individual relation groups (so-called relationships). Since a post can only be related to another post (and not a term, for instance), the type will be integrated into the relationship itself (and not into a related content entry, see next table).
The (auto-incremented, hence unique)
idcolumn will be used as primary key.{$table_prefix}mlp_content_relationsrelationship_idsite_idcontent_idThis table handles the individual content elements.
The unique combination
(relationship_id,site_id,content_id)will serve as primary key, and, for efficient querying, we will also add the composite key(site_id,content_id).Why exactly those keys, you ask? Please read this thread on the DBA StackExchange.
The refactoring will be performed as follows:
Mlp_Content_Relations,Mlp_Content_Relations_InterfaceandMlp_Content_Relations_Schema.Mlp_Relationship_Schema.feature.duplicate-blog.php;Mlp_Duplicate_Blogs.Mlp_Language_Api.Mlp_Translatable_Post_Data.Mlp_Relationship_Changer.Mlp_Term_Connector.Mlp_Term_Translation_Presenter.Mlp_Helpers.Mlp_Update_Plugin_Data.Mlp_Relationship_Control.Mlp_Relationship_Control_Ajax_Search.Mlp_Relationship_Control_Meta_Box_View.Mlp_Term_Translation_Selector.multilingual_linkedtable.MultilingualPressfront controller.uninstall.php.During or after the refactoring, we will also tackle all open Content Relations issues.
One of the things that are left open for now is how far we will go regarding backwards compatibility. When the time is right, we will discuss this.