Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.81 KB | None | 0 0
  1. #this account table is just temporary
  2. #may go into the sfGuard plugin instead
  3. Account:
  4.     actAs: [Timestampable]
  5.     tableName: account
  6.     columns:
  7.         id:
  8.             type: integer
  9.             primary: true
  10.             autoincrement: true
  11.         first_name: string(255)
  12.         last_name: string(255)
  13.         email: string(255)
  14.         password: string(255)
  15.  
  16. Customer:
  17.     actAs: [Timestampable, SoftDelete]
  18.     tableName: customer
  19.     columns:
  20.         customer_id:
  21.             type: integer
  22.             primary: true
  23.             autoincrement: true
  24.         name: { type: string(100), notnull: true }
  25.         city: string(100)
  26.         zipcode: int
  27.         address: string(100)
  28.         telephone: string(20)
  29.         fax: string(20)
  30.         homepage: string(100)
  31.         #sales: integer
  32.        information: string(500)
  33.         contact_person: integer
  34.         business_id: integer
  35.     relations:
  36.         Business: {onDelete: CASCADE, local: business_id, foreign: business_id}
  37.         Person: {onDelete: CASCADE, local: contact_person, foreign: person_id}
  38.  
  39. #health, news, sports, cars, and so on
  40. #just to show what customer the customer is doing, as business
  41. Business:
  42.     actAs: [Timestampable, SoftDelete]
  43.     tableName: business
  44.     columns:
  45.         business_id:
  46.             type: integer
  47.             primary: true
  48.             autoincrement: true
  49.         name: { type: string(20), notnull: true }
  50.        
  51. Person:
  52.     actAs: [Timestampable, SoftDelete]
  53.     tableName: person
  54.     columns:
  55.         person_id:
  56.             type: integer
  57.             primary: true
  58.             autoincrement: true
  59.         first_name: { type: string(100), notnull: true }
  60.         last_name:  { type: string(100), notnull: true }
  61.         telephone: string(20)
  62.         fax: string(20)
  63.         email: string(100)
  64.         note: string(500)
  65.         category: integer
  66.     relations:
  67.         PersonCategory: {onDelete: CASCADE, local: category, foreign: person_category_id}
  68.        
  69. PersonCategory:
  70.     actAs: [SoftDelete]
  71.     tableName: person_category
  72.     columns:
  73.         person_category_id:
  74.             type: integer
  75.             primary: true
  76.             autoincrement: true
  77.         name: { type: string(100), notnull: true }
  78.  
  79. #a customer may have several emails for several purposes
  80. #to list those with a description, could be nice (?)
  81. CustomerEmail:
  82.     actAs: [Timestampable, SoftDelete]
  83.     tableName: customer_email
  84.     columns:
  85.         customer_email_id:
  86.             type: integer
  87.             primary: true
  88.             autoincrement: true
  89.         email: { type: string(100), notnull: true }
  90.         description: string(100)
  91.  
  92. #this may be an anti-pattern
  93. CustomerPerson:
  94.     actAs: [Timestampable, SoftDelete]
  95.     tableName: customer_person
  96.     columns:
  97.         customer_id:
  98.             type: integer
  99.             primary: true
  100.             autoincrement: false
  101.             notnull: true
  102.         person_id:
  103.             type: integer
  104.             primary: true
  105.             autoincrement: false
  106.             notnull: true
  107.     relations:
  108.         Customer: {onDelete: CASCADE, local: customer_id, foreign: customer_id}
  109.         Person: {onDelete: CASCADE, local: person_id, foreign: person_id}
  110.  
  111. #then this will too be an anti-pattern
  112. CustomerEmails:
  113.     actAs: [Timestampable, SoftDelete]
  114.     tableName: customer_emails
  115.     columns:
  116.         customer_id:
  117.             type: integer
  118.             primary: true
  119.             autoincrement: false
  120.             notnull: true
  121.         customer_email_id:
  122.             type: integer
  123.             primary: true
  124.             autoincrement: false
  125.             notnull: true
  126.     relations:
  127.         Customer:  {onDelete: CASCADE, local: customer_id, foreign: customer_id}
  128.         CustomerEmail: {onDelete: CASCADE, local: customer_email_id, foreign: customer_email_id}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement