Revision table has a uid, but not the base table.

This means property queries using EFQ against contact owner fail (uid).

Proposed solution: nothing crazy, just add uid to the schema, add an update function and ensure the entity controller is using it correctly.

Comments

pingers’s picture

Status: Active » Needs review
StatusFileSize
new1.7 KB

Shouldn't be too much more than this patch... reviews welcome.

rosk0’s picture

Looks like this issue is bigger that seems at first glance.
Description of crm_core_contact_revision.uid said: "The users.uid that created this version.". But it stores UID of user that create the contact OR UID of user associated with contact. That's not all - there is no revisions of contacts. The revisions table is just an extended version of base table. I've also discovered that there is some bugs it saving created/changed timestamps, but have no time to collect more info. All of this probably should be decomposed to several issues, but I really have no time for it right now.

pingers’s picture

These have little do with this issue... they're just things you noticed while looking at it. Please open issues as appropriate.

pingers’s picture

"Description of crm_core_contact_revision.uid said: "The users.uid that created this version.". But it stores UID of user that create the contact OR UID of user associated with contact."
- What makes you think the role of uid column is shared? I.e. there's a relation to handle user->contact relationship. This is ONLY about which user created/updated the contact.

"That's not all - there is no revisions of contacts. The revisions table is just an extended version of base table."
- Yes, we have not enabled revisions, but entity api supports revisions. You should just need to set $entity->is_new_revision when saving a contact to create a revision. Haven't tried it though.

"I've also discovered that there is some bugs it saving created/changed timestamps, but have no time to collect more info. All of this probably should be decomposed to several issues, but I really have no time for it right now."
- Okay, so let's figure out if this is a real bug when we get time.

dealancer’s picture

The solution looks good.

I would prefer to test it when creating new contacts. Need to make sure uid field is populated correctly.

pingers’s picture

Please do :)

dealancer’s picture

Status: Needs review » Reviewed & tested by the community

Good work: update and new contact creating works well.

pingers’s picture

Status: Reviewed & tested by the community » Fixed

Committed in 84aa361

Anonymous’s picture

Status: Fixed » Closed (fixed)

wh00t!

  • Commit 84aa361 on development, import by pingers:
    #1914326 Resolve missing uid on crm_core_contact table.
    

  • Commit 84aa361 on development, import, activity_pages by pingers:
    #1914326 Resolve missing uid on crm_core_contact table.