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...)user1822– user18222014年07月26日 08:48:54 +00:00Commented Jul 26, 2014 at 8:48
-
I was expecting something like this: codex.wordpress.org/images/9/97/WP3.8-ERD.pngAnon– Anon2014年07月26日 08:57:16 +00:00Commented Jul 26, 2014 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 confirmKarthick– Karthick2014年07月26日 11:11:34 +00:00Commented Jul 26, 2014 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– Anon2014年07月26日 12:28:28 +00:00Commented Jul 26, 2014 at 12:28
2 Answers 2
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).
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– Karthick2014年07月26日 10:53:30 +00:00Commented Jul 26, 2014 at 10:53