I am trying to create the following schema with the following requirements.

* One to one Organization to sfGuardUser
* Each organization, may have multiple campaigns.
* Each campaign may have multiple addressbooks.
* MessageQueue holds general information for all
organizations/campaigns/addressbooks


Please let me know what should I do to make it correct... thank you.


# config/doctrine/schema.yml
Organization:
  actAs: { Timestampable: ~ }
  columns:
    sf_guard_user_id: { type: integer(4) }
    name: { type: string(255), notnull: true, unique: true }
    first_name:   { type: string(255) }
    last_name:    { type: string(255), notnull: true }
    phone:        { type: string(20) }
    mobile:       { type: string(20) }
    email:        { type: string(255), notnull: true }
    logo:         { type: string(255) }
    is_active:    { type: boolean, notnull: true, default: 1 }
  relations:
    sfGuardUser:
      foreign: id
      local: sf_guard_user_id
      owningSide: true
      type: one
      foreignType: one

Campaign:
  actAs: { Timestampable: ~ }
  columns:
    organization_id: { type: integer, notnull: true }
    name: { type: string(255), notnull: true, unique: false }
    keyword: { type: string(8), notnull: true, unique: true }
  relations:
    Organization:
      local: organization_id
      foreign: id
      foreignType: many

AddressBook:
  actAs: { Timestampable: ~ }
  columns:
    organization_id: { type: integer, notnull: true }
    campaign_id:     { type: integer, notnull: true }
    first_name:      { type: string(255) }
    last_name:       { type: string(255), notnull: true }
    mobile:          { type: string(20) }
    email:           { type: string(255) }
    is_active:       { type: boolean, notnull: true, default: 1 }
  relations:
    Organization:
      local: organization_id
      foreign: id
      foreignType: many

CampaignAddressBook:
  columns:
    campaign_id: { type: integer, primary: true }
    address_book_id: { type: integer, primary: true }
  relations:
    Campaign: { onDelete: CASCADE, local: campaign_id, foreign: id }
    AddressBook: {  onDelete: CASCADE, local: address_book_id, foreign: id }


MessageQueue:
  actAs:  { Timestampable: ~ }
  columns:
    organization_id: { type: integer, notnull: true }
    address_book_id: { type: integer, notnull: false }
    msg_from:            { type: string(255) }
    msg_to:              { type: string(255) }
    message_content:         { type: string(255) }
    status:
      type: enum
      values: [Pending,Delivered,Processed,Failed]
      notnull: true
    result_code:     { type: string(255) }
    direction:
      type: enum
      values: [Inbound,Outbound]
      notnull: true
    keyword:         { type: string(20) }
    message_option:          { type: string(255) }
    data:            { type: string(255) }
    response_type:
      type: enum
      values: [NORMAL,UNKNOWN]
      notnull: false
    delivery_type:
      type: enum
      values: [SMS,Email]
    carrier: { type: string(100) }
    network_type:
      type: enum
      values: [gsm,cdma,tdma,iden]
      notnull: false
    received_at: { type: timestamp, notnull: false }
  relations:
    Organization:    { local: organization_id, foreign: id }
    AddressBook:     { local: address_book_id, foreign: id }

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to