srwProduct:
  actAs: { Timestampable: ~ }
  columns: 
    name: { type: string(255), notnull: true }
    description: { type: string(4000) } 
    code: { type: string(255), notnull: true, unique: true }
    unit_id: { type: integer, notnull: true }
    category_id: { type: integer, notnull: true }
    weight: { type: float, notnull: true }
  relations:
    srwUnit: { onDelete: RESTRICT, local: unit_id, foreign: id }
    srwCategory: { onDelete: RESTRICT, local: category_id, foreign: id }  

srwUnit:
  columns:
    name: { type: string(255), notnull: true, unique: true }
    
srwCategory:
  actAs: 
    NestedSet:
      hasManyRoots: true
      rootColumnName: root_id    
  columns:
    name: { type: string(255), notnull: true }
    is_featured: { type: boolean, default: 0 }
    is_default: { type: boolean, default: 0 }
    
srwPhoto:
  actAs: { Timestampable: ~ }
  columns:
    filename: { type: string(4000), notnull: true }
    product_id: { type: integer, notnull: true }
    featured: { type: boolean, default: 0 }
  relations:
    srwProduct: { onDelete: CASCADE, local: product_id, foreign: id }
        
srwOrder:
  actAs: { Timestampable: ~ }
  columns:
    user_id:    { type: integer, notnull: true }
    invoice:    { type: boolean, notnull: true, default: 1 }
    name:       { type: string(255), notnull: true }
    email:      { type: string(255), notnull: true }
    address:    { type: string(4000), notnull: true }
    tax_no:     string(13)
    company:    string(255)
    total_weight: { type: float, notnull: true }
    
srwOrderProduct: 
  columns:
    order_id:   { type: integer, notnull: true }
    product_id: { type: integer, notnull: true }
    code:       { type: string(255), notnull: true }
    name:       { type: string(255), notnull: true }
    unit:       { type: string(255), notnull: true }
    weight:     { type: float, notnull: true }
    amount:     { type: integer, notnull: true }
  relations:
    srwOrder: { onDelete: CASCADE, local: order_id, foreign: id }
    
Profile: 
  columns:
    user_id:    { type: integer, notnull: true }    
    address:    { type: string(4000), notnull: true }
    tax_no:     string(13)
    company:    string(255)
    invoice:    { type: boolean, notnull: true, default: 1 }     
  relations:
    sfGuardUser: { onDelete: CASCADE, local: user_id, foreign: id, foreignType: one }