-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an Object Relationships Database Table #1429
base: develop
Are you sure you want to change the base?
Conversation
@mattyrob Thanks for getting that all working! This will now work for brand new sites. Will there need to be some extra code to ensure that these tables are created for sites that already exist? |
Seems that extra code will be needed to create the table. Edit: Maybe merging on the same day #1436 will make nightlies have the tables. |
Hmm, it looks like the Coding Standards / Pre-commit checks (pull_request) doesn't like the spread operator. I could change it to EDIT: now made the change anyway just to stop the failure! |
This is the start of an attempt to address Issue #1155.
One of my production sites depends on an object relationships table (and associated meta table), for which I created a plugin. This PR is an attempt to translate the code from that plugin into something that can be used for core.
The main table works by storing in the same row both an ID and an object type (such as
user
,comment
, or a specific custom taxonomy) for two objects. The table can then be checked to see if such a relationship exists, or a user can add or delete such a relationship, or they can get the ID of the second object if the details of the first and object type of the second are known.The meta table enables the creation, updating, getting, and deleting of metadata about the relationship. (CP automatically recognizes such functions if the tables follow the specific naming conventions used here.)
One obvious omission here is any attempt to include the information retrieved into CP's object cache. I'm hoping someone will add that.
Secondly (and more immediately), I cannot get the code to create the new databases to work. It works fine in my plugin, but not when added to
~wp-admin/includes/schema.php
. Instead, CP instantiates the database without these tables, and I receive the following message:Again, I'm hoping that someone can identify the problem here and fix it.