Assignment of Activities just changed in CiviCRM

I came to upgrade a CiviCRM install to version 4.4.4 which contained various customisations and found that the civicrm_activity_assignment table had vanished! Along with civicrm_activity_target.

Here's what they've done, in case anyone else needs to update their custom reports like I did:

Both tables have been merged into a new civicrm_activity_contact table which has

contact_id

activity_id

record_type_id

The last one is an integer with the following meanings:

Assignment record

Added By

With (aka "Target")

So in my SQL I had to:

With/target stuff:

replace civicrm_activity_target with civicrm_activity_contact

replace target_contact_id with just contact_id

AND add a filter for record_type_id = 3, so that we're finding targets and not assignments/adders.

With assigmnent

replace civicrm_activity_assignment with civicrm_activity_contact

replace assignee_contact_id with contact_id

AND add a filter for record_type_id = 1, so that we're finding targets and not assignments/adders.

I welcome this tidy-up of tables, it makes sense. I think I'd have been tempted to use an ENUM field because that would make a lot more sense when looking at the data, while maintaining the efficiency of an integer. I can hear the shouts of "the tables are not an API!", which is true, but you can't do everything with the API and most custom reports require knowledge of the table structures.

Enums are rather nice, though, where you're hard-coding integers that have simple meanings because you can have a policy of always referring to them as integers in your code, but your data makes sense when inspected at table level. But with this not being the normal way of accessing the data, and with the move to doctrine, I can see it's a sensible decision.