The goal of this project is to take another look and minimize the number of places we use entity_table / entity_id. Using this does have the advantage of the same code for multiple objects. However it is probably a bit inefficient and more importantly we cannot use th FK constraint checks of the database. I was pleasantly surprised and quite pleased that we were not using it a lot. The changes from this are expected to be quite minimal, IMO.
I've split this group up into three categories: Keep as is, Convert to, Handled by another Data Model Change, i.e. Activity, Location or Custom. Here are my recommendations:
Retain as is
Except for civicrm_note and civicrm_log, the others are fairly small table where this generalization is quite good. Note is used in quite a few places (contact, contribiution, event etc), that having the flexibility is good. Note can potentially be involved in search and export. Log is used for quite a few objects and is probably not searched a lot either.
- civicrm_dupe_match
- civicrm_price_set_entity
- civicrm_acl
- civicrm_acl_entity_role
- civicrm_mailing_group
- civicrm_log
- civicrm_note
- civicrm_uf_join
- civicrm_premiums
- civicrm_membership_block
- civicrm_entity_file - Need to understand a bit more
- civicrm_line_item - Need to understand a bit more
Change
Table |
New Foreign Key |
|---|---|
civicrm_financial_trxn |
contribution_id |
civicrm_participant_payment |
contribution_id |
civicrm_membership_payment |
contribution_id |
civicrm_entity_tag |
contact_id |
Handled by another Data Model Change
Activity
- civicrm_project
- civicrm_task
- civicrm_task_status
- civicrm_activity
- civicrm_meeting
- civicrm_activity_assignment
- civicrm_case_activity
- civicrm_phonecall
- civicrm_activity_history
Location
- civicrm_location
Custom Group / Field
- civicrm_custom_option
- civicrm_custom_value

2 Comments
Hide/Show CommentsJul 24, 2007
David Greenberg
A few thoughts on some Change items:
Jul 25, 2007
Donald A. Lobo
premiums and membership_block are used only in a few places, so i'd agree with you and keep is as is
tags have been there since 1.0. It is part of search at times, we have not put it in groups or events as yet (which i suspect means we wont do so anytime soon), and hence i think the redirection is just not worth it. hence i'd vote to change it