logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
vijay  
#1 Posted : Thursday, December 23, 2010 5:20:49 AM(UTC)
Rank: Administration
vijay
Groups: Registered, Developer, Administrators

Posts: 27

The following tables are used to add Tags to the Contact:

tag - tag_id is the primary key, tag_group_id is the foreign key of the taggroup table
taggroup - tag_id is the foreign key of the tag table, org_id is the organization id in the groups table. For ungrouped tags the name is always hardcoded to !!
tabobject - tag_id is the foreign key of the tag table, object_type_id = 14 (for contacts) and object_id is the same as the contact_id in the contactmeta table.

Here are the steps:

  1. Find the contact_id of the contact from the contactmeta table
  2. Get the org_id from the groups table
  3. Add an entry to the taggroups table
  4. Add an entry to the tag table
  5. Get the contact_id from the contactmeta table
  6. Add entries to the tagobject table

Lets see an example:

  • Adding a tag group: insert into taggroup (org_id, name) values (1, 'My Group') -- note tag_group_id is the primary key
  • Adding a tag: insert into tag (tag_group_id, name) values (1, 'My Tag') -- note that tag_id is the primary key, also you cannot have the same tag name for two entries.
  • Adding the required tags: insert into tagobject select 1, 14, 23


Note
that you can combine multiple sql statements into one using multiple insert and selects statements

WARNING: Please take a backup copy of the database before making any direct changes, any errors during these steps may take the database to an inconsistent state which may not be recoverable.

 

 

Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.