4

I am trying to generate the E-R Diagram of Wordpress using the 'Reverse Engineer' feature. There is a slight obstacle though. The diagram does not show the relationships between the entities. Is this the way it's supposed to work or am I missing something? enter image description here

  • Most probably Wordpress isn't using any foreign keys (as so many off-the-shelf products...) – a_horse_with_no_name Jul 26 '14 at 8:48
  • I was expecting something like this: codex.wordpress.org/images/9/97/WP3.8-ERD.png – Anon Jul 26 '14 at 8:57
  • @vDog As an example consider wp_links and wp_options. If suppose wp_links table primary key link_id has been used as a field in wp_options table then a link goes from wp_links table to wp_option table. Hope you have created tables in Phpmyadmin and using reverse engineer above ER diagram generated.If you have created through Phpmyadmin then you have not added indexes and foreign key constraints and so you are not getting relationship... pl confirm – Karthick Jul 26 '14 at 11:11
  • @Karthick I just performed the reverse engineer action on the default table generated after a wordpress install. I can try re-installing if this isn't normal behavior. – Anon Jul 26 '14 at 12:28
4

The EER diagram is correct. There should be no relationships because WordPress does not have any constraints. The EER diagram shown in the codex is only for reference (it's a dummy EER diagram). You must rely on other logical operations to make sure you have no orphaned data.

Source: https://codex.wordpress.org/Database_Description

Please note that within the standard installation of WordPress no integrity between the tables is enforced e.g. between posts and comments. If you are creating a plugin or extension that manipulates the WordPress database, your code should do the housekeeping so that no orphan records remain in the tables e.g. by removing records in other tables with a set of SQL commands when foreign keys are deleted (Don't forget to remind users to backup before such operations).

3

There is no Foreign key relationship and so there is no relationship reflecting in the tables..

  • @Colin'tHart Please check the schema where there is no foreign key constraints in any of the table and so relation ship is not reflecting. – Karthick Jul 26 '14 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.