Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: email table structures in sugar5

  1. #1
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default email table structures in sugar5

    i'm trying to understand the emails table schema in sugar5 and its introduction of "bean_id"

    for example, is the "bean_id" of email_addr_bean_rel the same as the bean_id of emails_beans - in other words
    is emails_beans linked to email_addr_bean_rel via the bean id?

    are there any documents/pointers on how the various email tables in sugar5 all link to each other?

  2. #2
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: email table structures in sugar5

    Perhaps this post: http://www.sugarcrm.com/forums/showp...97&postcount=3 will help to understand the DB-tables for emails.

  3. #3
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: email table structures in sugar5

    great diagram -thanks... but in my sugar5a and sugar 5b installs there isn't any bean_module table.


    mysql> show tables like "%bean%";
    +----------------------------+
    | Tables_in_sugar5a (%bean%) |
    +----------------------------+
    | email_addr_bean_rel |
    | emails_beans |
    +----------------------------+
    2 rows in set (0.00 sec)

    mysql> show tables like "%bean%";
    +----------------------------+
    | Tables_in_sugar5b (%bean%) |
    +----------------------------+
    | email_addr_bean_rel |
    | emails_beans |
    +----------------------------+
    2 rows in set (0.00 sec)

  4. #4
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: email table structures in sugar5

    The bean modules can be all modules like Accounts, Contacts, Opportunities,....
    Bean is only a synonym for all these modules.

  5. #5
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: email table structures in sugar5

    so where does the id for the bean module come from?

    ( i'm writing my own script to migrate a sugar 4 database to a sugar 5 database... which is why i need to understand this new email schema)

    is it one create_guid id for each module? so an id value for Leads, one for Accounts, another for Opportunities?

  6. #6
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: email table structures in sugar5

    just had a look at the example data for sugar5a. still not even sure why beans need to be in there for the purposes of normalising email address handling.

    any idea why bean ids are in there , and why an emails_beans table exists?

  7. #7
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: email table structures in sugar5

    The emails_beans table is the archive reference for emails.
    If you select "import to Sugar" in Email view, you can select a relation to a bean where you want to archive this email.

  8. #8
    netron is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    85

    Default Re: email table structures in sugar5

    Quote Originally Posted by kuske
    The emails_beans table is the archive reference for emails.
    If you select "import to Sugar" in Email view, you can select a relation to a bean where you want to archive this email.
    that doesnt really explain why there is a need for a "bean".

    i can understand the need for data normalisation with regards to email addresses - but where do these "beans" come in?

    what are they? and why is this extra complexity required?

    7 tables just to handle email seems over the top to me.

    still at a loss as to how to proceed with importing here. it seems to be needlessly complex.

  9. #9
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: email table structures in sugar5

    bean is only used as a generic word to mean any id from any table.

    For example the accounts_contacts table relates accounts to contacts and contains the fields id, account_id and contact_id becuase this is a hard coded relationship. id is the unique id for an entry in that table and its primary key. account_id always relates to the accounts table id field. contact_id always relates to the contacts table unique id field.

    But for emails you can relate an email address to any number of tables including accounts, contacts, leads, etc, etc., so rather than have a field for each possibly related table, you have one generic field that can be related to any table and it is generically referred to as a bean.

    bean simply means any id in any table that uniquely identifies a record in that table.

    With that definition, you can add an entry into email_addr_bean_rel to define a relationship for an email address to any other table saving that table's id that identifies a unique record in the bean_id field.

    You can similarly relate a sent email to any other table using the emails_beans table.

    Does that clarify or did I misunderstand your complaint?

    Phil

  10. #10
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: email table structures in sugar5

    Also note that bean_module is not the name of a table, but a generic placeholder for whatever table you want to relate to email addresses.

    For example the Contacts module uses the contacts table and the contacts table can have email addresses associated with contacts, so you should plug in the contacts table where bean_module is shown in the diagram. The bean_id in the email_addr_bean_rel table would be joined to the id field in the contacts table as the bean_id for contacts is the id field.

    Most of the reason for the perceived complexity is because both acutal sent emails and email_addresses are being mapped and because they can be mapped to any table for any module, so you need a generic representation for this.

    Phil

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Manually drop scheme (5.0 upgrade) ?
    By niallhannon in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2008-01-07, 05:41 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Fatal error: Max
    By spokes2k4 in forum Help
    Replies: 3
    Last Post: 2006-01-15, 03:50 PM
  4. php 5.0.4 + MySQL 5.0.9
    By sergiogu in forum Help
    Replies: 0
    Last Post: 2005-08-30, 04:38 PM
  5. Empty config.php at the end of install
    By aemadrid in forum Help
    Replies: 2
    Last Post: 2005-08-01, 06:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •