/[papo]/papo/zot/PAPO-ER.zot
ViewVC logotype

Diff of /papo/zot/PAPO-ER.zot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48 by mhepp, Tue Oct 7 21:01:24 2003 UTC revision 1.49 by mhepp, Thu Oct 23 20:10:58 2003 UTC
# Line 1  Line 1 
1  /*  _product_measure_data:
2        product -> product
3     Decripción en zot de la estructura de la base de datos (DER/ERD)      product_measure_type -> product_measure_type
4     zot description of the ERD/DER      _start_t (timestamp)
5        _end_t (timestamp)
6     $Id$      measure (numeric(12,4))
7        _table -> product_measure
8  */      _state -> __state__
9        id (bigint)
10  /*      :history:
11    _product_file_data:
12                          A D V E R T E N C I A      product -> product
13        _start_t (timestamp)
14                     _                _                  _            _end_t (timestamp)
15            __ _  __| |_   _____ _ __| |_ ___ _ __   ___(_) __ _      file -> file
16           / _` |/ _` \ \ / / _ \ '__| __/ _ \ '_ \ / __| |/ _` |      _table -> product_file
17          | (_| | (_| |\ V /  __/ |  | ||  __/ | | | (__| | (_| |      _state -> __state__
18           \__,_|\__,_| \_/ \___|_|   \__\___|_| |_|\___|_|\__,_|      id (bigint)
19        :history:
20    _alien_entity_data(entity):
21                          A D V E R T E N C I A      _start_t (timestamp)
22        _end_t (timestamp)
23          A partir de ahora, los dos tipos de comentarios son      _table -> alien_entity
24          dramáticamente diferentes: tipo C son comentarios per se,      _state -> __state__
25          mientras que los comentarios tipo shell son para      id (bigint)
26          documentación. *NO* usar comentarios por documentación ni      entity -> entity
27          viceversa: zot2xot no podrá extraer la documentación, y todo      :history:
28          se pierde. De todas maneras debieras estar escribiendo xot y  barter:
29          usando xot2zot para generar esto.      id (int)
30        :account:
31  */      :history:
32    _product_measure_type_data:
33  /*      _start_t (timestamp)
34     Explicación de los nombres:      _end_t (timestamp)
35        _table -> product_measure_type
36     Las tablas y columnas se nombran en inglés, de manera descriptiva,      _state -> __state__
37     en minúscula, separando palabras con barras bajas, y en      id (bigint)
38     singular. Es decir, por ejemplo, si la tabla describe la      name (varchar(80))
39     estructura de los productos se llamará product_structure.      :history:
40    movement_type:
41     Las tablas que se utilizan para expresar relaciones n:n llevarán      id (int)
42     su nombre en plural.      :history:
43    own_pos(own_entity):
44     Cuando una tabla se refiere a cosas de la empresa origen, es decir,      id (int)
45     la que está corriendo _esta_ instancia de PAPO, entonces esa tabla      :history:
46     es own_algo. Por ejemplo la tabla que se refiere a los documentos  erm_task:
47     emitidos por la propia empresa se llama own_document. El      erm -> erm
48     equivalente de esa tabla pero de documentos que son emitidos por      task -> task
49     otra entidad se llama alien_document.      id (int)
50        timestamp (timestamp)
51     Para una explicación detallada de la relación entre las tablas  entity:
52     entity, alien_entity, own_entity, alien_storehouse, contact,      id (int)
53     persona, client, provider, employee, own_storehouse, y own_branch      :account:
54     (y sus tablas auxiliares), ver el archivo HERENCIA.txt.      :history:
55    persona_tax_profile:
56  */      id (int)
57        :history:
58  /*  task_type:
59     PLEASE NOTE!      id (int)
60     These 'styles' have side effects!      :history:
61  */  credit_card_movement(movement):
62  :entry: shape=ellipse      timestamp (timestamp)
63  :account: style=filled      movement -> movement
64  :history: peripheries=2      id (bigint)
65        entry -> entry
66  # own_document      plan -> credit_card_plan
67  # Here we store all the documents ever produced by us (as program user),      :entry:
68  # incliding those which were voided.  _category_entity_type_data:
69  own_document:      category_type -> category_type
70        _start_t (timestamp)
71  #       everything called "id" is automagically a primary key.      _end_t (timestamp)
72          id (bigserial)      entity_type -> entity_type
73        _table -> category_entity_type
74  #       the document type      _state -> __state__
75          own_document_type -> document_type      id (bigint)
76        :history:
77  #       the recipient is the target of the document; it's the answer  alien_document_proceeding:
78  #       to "for who is this document?"      amount (numeric(12,4))
79          recipient -> entity      proceeding -> proceeding
80        entry -> entry
81  #       some documents have an associated address. E.g. the "remito"      timestamp (timestamp)
82  #       must include the address of the destination      id (bigint)
83          address (varchar(255))      alien_document -> alien_document
84        :entry:
85  #       the shipping company of the associated merchandise, if  _bank_account_data:
86  #       applicable      credit (numeric(12,4))
87          transport -> entity      credit_timestamp (timestamp)
88        _start_t (timestamp)
89  #       shipping companies usually give you a tracking or guide number      _end_t (timestamp)
90          guide_number (char(30))      overdraft (numeric(12,4))
91        _table -> bank_account
92  #       the number of packages that were shipped      _state -> __state__
93          bundles (int)      bank_branch -> entity
94        id (bigint)
95  #       if e.g. a sale on credit was made over and above the credit      :history:
96  #       limit of the client, "who was the blockhead that authorized  _account_plan_data:
97  #       that?"      balance (numeric(12,4))
98          authorized_by -> entity      code (varchar(40))
99        _start_t (timestamp)
100  #       "and for _how_ much did you say he authorized the guy?"      name (varchar(40))
101          authorized_amount (numeric(12,4))      parent -> account_plan
102        _state -> __state__
103  #       who (what) made this document. Not the salesperson (q.v.), but      chargeable (boolean)
104  #       the physical building or whatever (cash point, etc.)      path (varchar(255))
105          own_entity -> entity      _table -> account_plan
106        id (bigint)
107  #       have we had to void this document?      _end_t (timestamp)
108          is_void (boolean)      :history:
109    _employee_comm_client_data:
110  #       what day was this document made?      commission -> commission
111          date (timestamp)      client -> entity
112        _start_t (timestamp)
113          due_date (timestamp)      _end_t (timestamp)
114        employee -> entity
115  #       what is the number printed on this document?      _table -> employee_comm_client
116          number (char(30))      _state -> __state__
117        id (bigint)
118  #       who or what was the salesperson that handled the transaction      :history:
119  #       that ended with this document?  product_classification:
120          salesperson -> entity      id (int)
121        :history:
122  #       what time did the salesperson start to make out this document?  bank(persona):
123          start_timestamp (timestamp)      id (int)
124        :history:
125  #       what time did he finish?  _product_data:
126          end_timestamp (timestamp)      _start_t (timestamp)
127  #       what document is related to ie(invoive is related to despatch note 00000098/99/100)            _end_t (timestamp)
128          related_to (varchar(255))      commission -> commission
129        country -> country
130  #       blow your mind      salable (boolean)
131          observations (text)      _state -> __state__
132        account_plan -> account_plan
133          discount_percent (numeric(12,4))      product_classification -> product_classification
134        stockable (boolean)
135          exempt_net_total (numeric(12,4))      is_perishable (boolean)
136        canonical_name (varchar(80))
137          net_total (numeric(12,4))      location -> physical_structure
138        _table -> product
139          tax_total (numeric(12,4))      id (bigint)
140                :account:
141  #       generates an accounting entry      :history:
142          :entry:  document4document:
143        own_document -> own_document
144  # own_document_tax      timestamp (timestamp)
145  # the taxes associated with this document      entry -> entry
146  own_document_tax:      id (bigint)
147  #       the primary key      alien_document -> alien_document
148          id (bigserial)      :entry:
149    employee(own_entity):
150  #       what document is this tax about?      id (int)
151          own_document -> own_document      :history:
152    logical_structure:
153  #       what tax is this?      id (int)
154          tax -> tax      :history:
155    address_type:
156  #       how much?      id (int)
157          amount (numeric(12,4))      :history:
158    _employee_comm_prod_data:
159  #       total has the accounting entry.      commission -> commission
160  #       generates an accounting entry      product -> product
161  #       :entry:      _start_t (timestamp)
162        _end_t (timestamp)
163        employee -> entity
164  # alien_document      _table -> employee_comm_prod
165  # Documents made by other people. Similar to own_document, but less      _state -> __state__
166  # information.      id (bigint)
167  alien_document:      :history:
168  #       primary key  _entity_relation_data:
169          id (bigserial)      _start_t (timestamp)
170          alien_document_type -> document_type      _end_t (timestamp)
171        entity_from -> entity
172  #       The entity who made the document.      _table -> entity_relation
173          sender -> entity      _state -> __state__
174        id (bigint)
175  #       The salesperson in the other organization who is responsible      entity_to -> entity
176  #       before us for the transaction described in this document      :history:
177          salesperson -> entity  product_store:
178        id (bigint)
179  #       the shipping company of the associated merchandise, if      :history:
 #       applicable  
         transport -> entity  
   
 #       shipping companies usually give you a tracking or guide number  
         guide_number (char(30))  
   
 #       the number of packages that were shipped  
         bundles (int)  
   
 #       The person who signed the receipt  
         received_by -> entity  
   
 #       Which of the 'us'es this is for (physical building etc)  
         own_entity -> entity  
   
 #       Have we had to void this document for some reason?  
         is_void (boolean)  
   
 #       The number of this document  
         number (char(30))  
   
 #       date of emission  
         date (timestamp)  
   
         due_date (timestamp)  
   
 #       time the document loading was started  
         start_timestamp (timestamp)  
   
 #       time the document loading was finished  
         end_timestamp (timestamp)  
   
 #       blow your mind  
         observations (text)  
   
         discount_percent (numeric(12,4))  
   
         exempt_net_total (numeric(12,4))  
   
         net_total (numeric(12,4))  
   
         tax_total (numeric(12,4))  
   
 #       generates an accounting entry  
         :entry:  
   
 # alien_document_tax  
 alien_document_tax:  
 #       primary key  
         id (bigserial)  
   
 #       what document is this tax about?  
         alien_document -> alien_document  
   
 #       what tax is this?  
         tax -> tax  
   
 #       how much?  
         amount (numeric(12,4))  
   
 #       generates an accounting entry  
         :entry:  
   
 # document_type  
 document_type:  
 #       the primary key  
         id (serial)  
   
 #       nemonic code  
         code (char(4))  
   
 #       what is this document type?  
         name (varchar(80))  
   
 #       that doesn't say a thing to me. Tell me more.  
         description (text)  
   
 #       this table mirrors an entry in account_plan  
         :account:  
   
 #       this table has a history (or "transactional")  
         :history:  
   
 # own_item  
 #       Items of own documents  
 own_item:  
 #       the primary key  
         id (bigserial)  
   
 #       how much bonus we're giving the recipient on this item  
         bonus (numeric(12,4))  
   
 #       ditto discount  
         discount (numeric(12,4))  
   
 #       what document is it?  
         own_document -> own_document  
         :account:  
         :entry:  
   
 # own_product_item  
 #       Items of own documents that refer to products  
 #         is a own_item  
 own_product_item(own_item):  
         id (bigserial)  
   
 #       # of products  
         qty (numeric(12,4))  
   
 #       price used (points to historic value)  
         price -> price  
         unit_price (numeric(12,4))  
   
 #       genealogical parent  
         own_item -> own_item  
         :account:  
         :entry:  
   
 # own_descriptive_item  
 #       Items of own documents  
 #         is a own_item  
 own_descriptive_item(own_item):  
         id (bigserial)  
         description (text)  
   
 #       $$$  
         amount  (numeric(12,4))  
         own_item -> own_item  
         :account:  
         :entry:  
   
 # own_maintenance_item  
 own_product_stock_item(own_item):  
   id (bigserial)  
   own_item -> own_item  
   product -> product  
 # the difference betwwen what the system says and what the real world says  
 # may be negative  
   difference (numeric(12,4))  
   observations (text)  
   
 # own_item_tax  
180  own_item_tax:  own_item_tax:
181          id (bigserial)      amount (numeric(12,4))
182          own_item -> own_item      entry -> entry
183          tax -> tax      timestamp (timestamp)
184          amount (numeric(12,4))      tax -> tax
185          :entry:      own_item -> own_item
186        id (bigint)
187  # alien_item      :entry:
188  # is to alien_document what own_item is to own_document  cheque_movement(movement):
189  alien_item:      timestamp (timestamp)
190          id (bigserial)      movement -> movement
191          bonus (numeric(12,4))      id (bigint)
192          discount (numeric(12,4))      entry -> entry
193          alien_document -> alien_document      cheque -> cheque
194          :account:      :entry:
195          :entry:  _document_type_data:
196        code (char(4))
197  #  alien_product_item      _start_t (timestamp)
198        description (text)
199        name (varchar(80))
200        id (bigint)
201        _table -> document_type
202        _state -> __state__
203        account_plan -> account_plan
204        _end_t (timestamp)
205        sign (boolean)
206        :account:
207        :history:
208    _product_name_data:
209        product -> product
210        _start_t (timestamp)
211        product_name_type -> product_name_type
212        maximum_length (int)
213        _table -> product_name
214        _state -> __state__
215        id (bigint)
216        _end_t (timestamp)
217        name (varchar(80))
218        :history:
219    _tax_formula_data:
220        _start_t (timestamp)
221        _end_t (timestamp)
222        graft (text)
223        _table -> tax_formula
224        _state -> __state__
225        id (bigint)
226        from_profile -> tax_profile
227        to_profile -> tax_profile
228        :history:
229    entity_type_uid_conf:
230        timestamp (timestamp)
231        id (int)
232        entity_uid_type -> entity_uid_type
233        entity_type -> entity_type
234  alien_product_item:  alien_product_item:
235          id (bigserial)      product -> product
236          qty (numeric(12,4))      account_plan -> account_plan
237          unit_price (numeric(12,4))      entry -> entry
238          product -> product      timestamp (timestamp)
239          alien_item -> alien_item      qty (numeric(12,4))
240          :account:      id (bigint)
241          :entry:      unit_price (numeric(12,4))
242        alien_item -> alien_item
243        :account:
244  #  alien_service_item      :entry:
245  alien_service_item:  category_entity_type:
246          id (bigserial)      id (int)
247          description (text)      :history:
248          amount  (numeric(12,4))  ticket:
249          alien_item -> alien_item      id (int)
250          :account:      :account:
251          :entry:      :history:
252    document_type:
253        id (int)
254        :account:
255        :history:
256  # alien_item_tax  _tax_data:
257  alien_item_tax:      _start_t (timestamp)
258          id (bigserial)      name (varchar(80))
259          alien_item -> alien_item      _table -> tax
260          tax -> tax      _state -> __state__
261          amount (numeric(12,4))      account_plan -> account_plan
262          :entry:      _end_t (timestamp)
263        id (bigint)
264  # Product      :account:
265  # Salable stuff      :history:
266  product:  _credit_card_data:
267          id (serial)      _table -> credit_card
268        _start_t (timestamp)
269  #       canonical name of the product, i.e. the default name, the name      name (varchar(80))
270  #       to use unless we know or need otherwise      accreditation_account -> bank_account
271          canonical_name (varchar(80))      ownid (int)
272        accreditation_date (timestamp)
273  #       see product_classification for an explanation      _state -> __state__
274          product_classification -> product_classification      account_plan -> account_plan
275        _end_t (timestamp)
276  #       commission given to the salesperson for selling this product      id (bigint)
277          commission -> commission      :account:
278        :history:
279  #       is this product subject to the whims of time?  bank_account:
280          is_perishable (boolean)      id (int)
281        :history:
282          salable (boolean)  task_recipient:
283        timestamp (timestamp)
284  #       origin, i.e. where this product came from. This can be NULL in      task -> task
285  #       case we either don't know the origin, or it more complicated      id (int)
286  #       than a single country (in which case if you want to know the      to_make_to -> entity
 #       right way is to use product_structure and look up the origins  
 #       of the parts)  
         country -> country  
   
 #       where the F*** did I put this thing?  
         location -> physical_structure  
         :account:  
         :history:  
   
 # product_name  
 # a product can (and usually does) have more than one name. E.g. the  
 # name that goes on the shelf is different to the one on the ticket:  
 # this last one is usually shorter.  
 product_name:  
         id (serial)  
         product -> product  
         product_name_type -> product_name_type  
         name (varchar(80))  
   
 #       the maximum length of this name  
         maximum_length (int)  
         :history:  
   
 # product_name_type  
 product_name_type:  
         id (serial)  
         name (varchar(80))  
   
 #       is this name requisite?  
         is_required (boolean)  
         :history:  
   
 # product_code and product_code_type  
   
 # a product can (and usually does) have more than one code. E.g. there  
 # are several "standard" barcodes...  
   
 product_code:  
         id (serial)  
         product -> product  
         product_code_type -> product_code_type  
         code (varchar(30))  
         :history:  
   
287  product_code_type:  product_code_type:
288          id (serial)      id (int)
289          name (varchar(80))      :history:
290          :history:  _entity_attribute_data:
291        _start_t (timestamp)
292  # product_measure and product_measure_type      _end_t (timestamp)
293        category_attribute -> category_attribute
294  # a product may be measured (or counted?) in several ways, e.g. weight,      _table -> entity_attribute
295  # size, etc.      _state -> __state__
296        id (bigint)
297  product_measure:      entity -> entity
298          id (serial)      :history:
299          product -> product  alien_descriptive_item:
300          product_measure_type -> product_measure_type      amount (numeric(12,4))
301          measure (numeric(12,4))      description (text)
302          :history:      entry -> entry
303        id (bigint)
304  product_measure_type:      timestamp (timestamp)
305          id (serial)      account_plan -> account_plan
306          name (varchar(80))      alien_item -> alien_item
307          :history:      :account:
308        :entry:
309  # product_classification  third_party_cheque_tax:
310        timestamp (timestamp)
311  # A product is classified in a hierarchical structure.      third_party_cheque -> third_party_cheque
312        tax -> tax
313  product_classification:      id (bigint)
314          id (serial)  tax_formula:
315          name (varchar(255))      id (int)
316  #       parent can be NULL (topmost nodes)      :history:
317          parent -> product_classification  relation_types:
318  #       is this a leaf?      id (int)
319          is_product (boolean)      :history:
 #       explain yourself!  
         description (text)  
         :history:  
   
 # product_store  
   
 # each of our products in each of our storehouses has a level (how many  
 # there are), a low water mark below which certain warnings should be  
 # issued and a high water mark above which certain other warnings should  
 # be issued. Usually "buy!" and "sale!".  
   
 product_store:  
         id (bigserial)  
         product -> product  
         storehouse -> entity  
         hiwater (numeric(12,4))  
         lowater (numeric(12,4))  
         level (numeric(12,4))  
         :history:  
   
 # product_provider  
   
 # each product can be provided by 1 or more providers (or 0, but then it  
 # won't be here :)  
   
 product_provider:  
         id (bigserial)  
         product -> product  
         provider -> entity  
         catalog_number (char(30))  
         :history:  
   
 # product_tax  
 product_tax:  
         id (bigserial)  
         product -> product  
         tax -> tax  
         amount (numeric(12,4))  
         :entry:  
         :history:  
   
 # product_structure  
   
 # any product that is made of several products and was not bought as a  
 # product is reflected here.  
   
 # in case you don't notice, this is a tree:  
   
 #    product     component   qty  
 #    ~~~~~~~     ~~~~~~~~~   ~~~  
 #    cake        egg         1  
 #    cake        1kg flour   0.4  
 #    cake        1kg sugar   0.6  
   
   
 product_structure:  
         id (bigserial)  
         component -> product  
         product -> product  
         qty (numeric(12,4))  
         :history:  
   
 # product_file  
   
 # Often one wants to link some files to a product, e.g. a photo, a  
 # datasheet, etc. Here is how.  
   
 product_file:  
         id (bigserial)  
         product -> product  
         file -> file  
         :history:  
   
 # File  
   
 # Different things might want to have files associated (product,  
 # entities). This is the generic file.  
   
 file:  
         id (serial)  
   
 #       e.g. 'image/jpeg'  
         mimetype (char(80))  
   
 #       what app created this file  
         application (char(15))  
   
 #       MD5 of the original file  
         checksum (char(32))  
   
 #       size in bytes of the original file  
         size (int)  
   
 #       original name (because now it'll be called like the id, or something)  
         filename (varchar(255))  
         :history:  
   
 # price and price_type  
   
 # each client (q.v.) has an associated price_type, that is, a price  
 # list.  
   
 price:  
         id (bigserial)  
         price_type -> price_type  
         product -> product  
 #       price per unit  
         unit_price (numeric(12,4))  
 #       the currency in which the price is  
         currency_type -> currency_type  
 #       if the product is excluded for the this price_type  
         excluded (boolean)  
         :history:  
   
 price_type:  
         id (serial)  
   
 #       name of this type  
         name (varchar(80))  
   
 #       parent (where to start to recursively look for products not  
 #       found in this list)  
         parent -> price_type  
   
 #       what branch is this pricelist for? branches can have their  
 #       own, yes.  
         branch -> entity  
   
 #       is this price_type active? a price_type can be inactive but be  
 #       inside its dates.  
         is_active (boolean)  
   
 #       what time this price_type activates  
         start_date (timestamp)  
   
 #       what time this price_type deactivates  
         end_date (timestamp)  
   
 #       how to calculate the price based on the unit_price and  
 #       anything else you care to mention  
         formula (text)  
         :history:  
   
 # document4document  
   
 # most operations (movement or proceeding) relate one own_document with  
 # one alien_document in some way. Here is which.  
   
 document4document:  
         id (bigserial)  
         own_document -> own_document  
         alien_document -> alien_document  
         :entry:  
   
 # document_relation_type  
   
 document_relation_type:  
         id (serial)  
         name (varchar(80))  
   
 # own_doc4own_doc  
 # example:  relation => invoice of dispatch note    
 #           from => invoice    
 #           to => despatch note  
   
320  own_doc4own_doc:  own_doc4own_doc:
321          id (serial)      document_to -> own_document
322          document_from -> own_document      timestamp (timestamp)
323          document_to -> own_document      id (int)
324          relation_type -> document_relation_type      relation_type -> document_relation_type
325        document_from -> own_document
326  # alien_doc4alien_doc  _entity_type_data:
327        _start_t (timestamp)
328  alien_doc4alien_doc:      name (varchar(80))
329          id (serial)      parent -> entity_type
330          document_from -> alien_document      _table -> entity_type
331          document_to -> alien_document      _state -> __state__
332          relation_type -> document_relation_type      id (bigint)
333        _end_t (timestamp)
334  # own_pos_document      :history:
335    own_document_tax:
336  # most documents are assigned a number that is _not_ the ID of the      amount (numeric(12,4))
337  # document, but the number of that document in the branch or sale point      taxed_amount (numeric(12,4))
338  # or whatever. Here is what.      own_document -> own_document
339        timestamp (timestamp)
340  own_pos_document:      tax -> tax
341          id (serial)      id (bigint)
342          document_type -> document_type  _relation_types_data:
343          own_pos -> entity      _start_t (timestamp)
344          number (char(30))      _end_t (timestamp)
345          print_command (varchar(255))      entity_relation -> entity_relation
346          :history:      _table -> relation_types
347        _state -> __state__
348  # Entity      id (bigint)
349        relation_type -> relation_type
350  # This is the parent of all objects we are or relate to. If it's got a      :history:
351  # name and an address (and a couple of other things), it's an entity.  task_priority:
352        id (int)
353  entity:      :history:
354          id (serial)  _tax_profile_data:
355        profile (varchar(80))
356        _start_t (timestamp)
357  #       The name of the entity. This should be a table.      _end_t (timestamp)
358          name (varchar(255))      tax -> tax
359        _table -> tax_profile
360  #       When this entity celebrates its inception.      _state -> __state__
361          anniversary (date)      id (bigint)
362        :history:
363  #       when we first came to know this entity  _own_pos_data(own_entity):
364          start_time (timestamp)      _start_t (timestamp)
365        _end_t (timestamp)
366  #       does this entity exist any more?      _state -> __state__
367          is_active (boolean)      _table -> own_pos
368        own_entity -> own_entity
369  #       blow your mind      id (bigint)
370          observations (text)      stock_by_invoice (boolean)
371          :history:      number (char(4))
372          :account:      :history:
373  # entity_type  _own_branch_data(own_entity):
374  #       the different kinds that an entity can be.      _start_t (timestamp)
375        _end_t (timestamp)
376  entity_types:      own_entity -> own_entity
377          id (serial)      _table -> own_branch
378          entity_type -> entity_type      _state -> __state__
379          entity -> entity      id (bigint)
380          :history:      number (char(4))
381        :history:
382  # entity_type_uid_conf  _bank_data(persona):
383        persona -> persona
384        _start_t (timestamp)
385  entity_type_uid_conf:      name (varchar(80))
386          id (serial)      _table -> bank
387          entity_type -> entity_type      _state -> __state__
388          entity_uid_type -> entity_uid_type      id (bigint)
389        _end_t (timestamp)
390  # entity_uid and entity_uid_type      :history:
391    physical_structure:
392  #        A number that uniquely identifies this entity amongst its      id (int)
393  #        peers.      :history:
394  entity_uid_type:  bank_branch(persona):
395          id (serial)      id (int)
396          name (varchar(255))      :history:
397          :history:  own_branch(own_entity):
398        id (int)
399  entity_uid:      :history:
400          id (serial)  _obligation_type_data:
401          entity -> entity      _start_t (timestamp)
402          entity_uid_type -> entity_uid_type      description (text)
403          uid (varchar(50))      id (bigint)
404          :history:      _table -> obligation_type
405        _state -> __state__
406  # entity_currency_type      account_plan -> account_plan
407        _end_t (timestamp)
408  # what currencies an entity handles      name (varchar(80))
409        :account:
410  entity_currency_type:      :history:
411          id (serial)  product_code:
412          entity -> entity      id (int)
413          currency_type -> currency_type      :history:
414          :history:  employee_comm_prod_client:
415        id (bigint)
416  # credit_limit      :history:
417    product_provider:
418  # an entity has different credit limits for each movement type.      id (bigint)
419        :history:
420  credit_limit:  proceeding:
421          id (serial)      responsable -> entity
422        branch -> entity
423  #       who this credit limit is about      entry -> entry
424          entity -> entity      date (timestamp)
425        timestamp (timestamp)
426  #       which movement type      id (bigint)
427          movement_type -> movement_type      :entry:
428    _product_code_data:
429  #       how much      code (varchar(30))
430          credit_limit (numeric(12,4))      product -> product
431        product_code_type -> product_code_type
432  #       performance things. We could find out the balance by wading      _start_t (timestamp)
433  #       through the movement tables from the beginning of time      _end_t (timestamp)
434  #       onwards. The idea is to wade once every so often when the      _table -> product_code
435  #       system is inactive, and then during the day just wade from the      _state -> __state__
436  #       timestamp on.      id (bigint)
437          balance (numeric(12,4))      :history:
438          time_stamp (timestamp)  _logical2physical_data:
439          :history:      _start_t (timestamp)
440        _end_t (timestamp)
441  # address is general: address, telephone, url, whatever attributes to locate entities.      _table -> logical2physical
442  # the value is in address and the type in address_type as obvious      _state -> __state__
443        id (bigint)
444  address:      logical -> logical_structure
445          id (serial)      physical -> physical_structure
446          entity -> entity      :history:
         address_type -> address_type  
         address (varchar(255))  
         comment (varchar(80))  
         :history:  
   
 address_type:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
 # entity_type  
   
 # the type of an entity. At first we thought entities would need a type  
 # to tell them apart. So far we haven't: it's usually obvious from the  
 # context (and from the joins). Pretty self-explanatory.  
   
447  entity_type:  entity_type:
448          id (serial)      id (int)
449          name (varchar(80))      :history:
450          parent -> entity_type  entity_uid:
451          :history:      id (int)
452        :history:
453  # entity_relation and (entity_)relation_type  _price_data:
454        currency_type -> currency_type
455  # these document the relations between enttities. Pretty      product -> product
456  # self-explanatory, too.      _start_t (timestamp)
457        _end_t (timestamp)
458  entity_relation:      excluded (boolean)
459          id (serial)      price_type -> price_type
460          entity_from -> entity      _table -> price
461          entity_to -> entity      _state -> __state__
462          :history:      id (bigint)
463        unit_price (numeric(12,4))
464  relation_types:      :history:
465          id (serial)  _employee_data(own_entity):
466          entity_relation -> entity_relation      commission -> commission
467          relation_type -> relation_type      _start_t (timestamp)
468          :history:      _end_t (timestamp)
469        own_entity -> own_entity
470  relation_type:      _table -> employee
471          id (serial)      _state -> __state__
472          name (varchar(255))      id (bigint)
473          :history:      :history:
   
 # entity categories and attributes.  
 # intended to group entities of the same categories  
 # example:  
 # category type   category attribute  
 # size  <------ big ,  
 #           |__ small  
 #           |__ mid  
   
 # heading       <------ automotive,  
 #           |__ electronics  
   
 entity_attribute:  
         id (serial)  
         entity -> entity  
         category_attribute -> category_attribute  
         :history:  
   
 category_attribute:  
         id (serial)  
         name (varchar(80))  
         category_type  -> category_type  
         :history:  
   
   
474  category_type:  category_type:
475          id (serial)      id (int)
476          name (varchar(80))      :history:
477          :history:  alien_document_tax:
478        amount (numeric(12,4))
479  category_entity_type:      taxed_amount (numeric(12,4))
480          id (serial)      entry -> entry
481          entity_type -> entity_type      timestamp (timestamp)
482          category_type -> category_type      tax -> tax
483          :history:      id (bigint)
484        alien_document -> alien_document
485  # alien_entity      :entry:
486    product_structure:
487  # entities that are not "us".      id (bigint)
488        :history:
 # is a entity  
   
 alien_entity(entity):  
         id (serial)  
         entity -> entity  
         :history:  
   
 # own_entity  
   
 # entities that _are_ "us".  
   
 # is a entity  
   
 own_entity(entity):  
         id (serial)  
         entity -> entity  
         :history:  
   
 # alien_storehouse  
   
 # entities where other people store their stuff.  
   
 # is a alien_entity  
   
 alien_storehouse(alien_entity):  
         id (serial)  
         alien_entity -> alien_entity  
         :history:  
   
   
 # Contact  
   
 # contacts are the people, inside alien entities, that we talk to.  
   
 # is a alien_entity  
   
 contact(alien_entity):  
         id (serial)  
         alien_entity -> alien_entity  
         :history:  
   
 # Persona  
   
 # a legal entity (person, business, ...). That is, something you can  
 # sign a contract with, or something you can sue, depending where you  
 # live :)  
   
 # is a alien_entity  
   
 persona(alien_entity):  
         id (serial)  
         alien_entity -> alien_entity  
         :history:  
   
 # Client  
   
 # an entity that is a client  
   
 # is a persona  
   
 client(persona):  
         id (serial)  
         persona -> persona  
   
 #       what price list this client has  
         price_type -> price_type  
   
 #       how much commission we get for selling to this person  
         commission -> commission  
 #       app-specific score, for contests, bonuses, or whatever  
         score (int)  
         :history:  
   
 # provider  
   
 # an entity that is a provider (duh...)  
   
 # is a persona  
489  provider(persona):  provider(persona):
490          id (serial)      id (int)
491          persona -> persona      :history:
492          :history:  own_item:
493        discount (numeric(12,4))
494  # tax_profile and persona_tax_profile      entry -> entry
495        bonus (numeric(12,4))
496  # different personæ belong in different 'tax brackets'; each of these      timestamp (timestamp)
497  # would be a profile. So you tag a persona as belonging to a certain tax      own_document -> own_document
498  # bracket. This means you should define one tax_profile for each bracket      account_plan -> account_plan
499  # for each tax...      id (bigint)
500        :account:
501  tax_profile:      :entry:
502          id (serial)  _role_data:
503          profile (varchar(80))      _start_t (timestamp)
504          tax -> tax      _end_t (timestamp)
505          :history:      _table -> role
506        _state -> __state__
507  persona_tax_profile:      id (bigint)
508          id (serial)      name (varchar(80))
509          persona -> entity      :history:
         tax_profile -> tax_profile  
         :history:  
   
 # Employee  
   
 # people on our payroll  
   
 # is a own_entity  
   
 employee(own_entity):  
         id (serial)  
         own_entity -> own_entity  
   
 #       how much commission this employee gets for selling stuff in  
 #       general  
         commission -> commission  
         :history:  
   
 # employee_comm_x_client  
   
 # certain employees may recieve a specific commission for selling to a  
 # certain client  
   
 # all these (*_commission_*) are shortened so they stand some  
 # chance of working.  
   
 employee_comm_client:  
         id (bigserial)  
         employee -> entity  
         client -> entity  
         commission -> commission  
         :history:  
   
 # employee_commission_x_product  
   
 # certain employees may recieve a specific commission for selling a  
 # certain product  
   
 employee_comm_prod:  
         id (bigserial)  
         employee -> entity  
         product -> product  
         commission -> commission  
         :history:  
   
 # employee_commission_x_product_n_client  
   
 # certain employees may recieve a specific commission for selling a  
 # certain product to a certain client  
   
 employee_comm_prod_client:  
         id (bigserial)  
         employee -> entity  
         product -> product  
         client -> entity  
         commission -> commission  
         :history:  
   
 # commission_x_proudct_n_client  
   
 # all employees may recieve a specific commission for selling a  
 # certain product to a certain client  
   
 comm_prod_client:  
         id (bigserial)  
         product -> product  
         client -> entity  
         commission -> commission  
         :history:  
   
   
 # role and employee_role  
   
 # this is /etc/group :)  
   
 role:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
 employee_role:  
         id (serial)  
         role -> role  
         employee -> entity  
         :history:  
   
 # own_storehouse  
   
 # places where we store our stuff  
   
 # is a own_entity  
   
 own_storehouse(own_entity):  
         id (serial)  
         own_entity -> own_entity  
         :history:  
   
 # own_branch  
   
 # branches, as in main office vs. branches  
   
 # is a own_entity  
   
 own_branch(own_entity):  
         id (serial)  
         own_entity -> own_entity  
         number (char(4))  
         :history:  
   
 # own_pos Ower Point of Sale    
   
 own_pos(own_entity):  
         id (serial)  
         own_entity -> own_entity  
         number (char(4))  
         stock_by_invoice (boolean)  
         :history:  
   
   
   
 # organization  
   
 organization(own_entity):  
         id (serial)      
         own_entity -> own_entity  
         :history:        
   
 # tax  
   
 # all taxes go in this table.  
   
 tax:  
         id (serial)  
         name (varchar(80))  
 #       this is a chunk of code used to work out how much tax we  
 #       should pay  
 #       graft (text)  
         :account:  
         :history:  
   
   
 # tax_formula  
 # from : seller  
 # to : buyer  
   
 tax_formula:  
         id (serial)  
         from_profile -> tax_profile  
         to_profile -> tax_profile  
         graft (text)  
 #       :account:  
         :history:  
 # proceeding  
 # a proceeding is a guy coming up to the cashier and paying up. Or  
 # viceversa. A proceeding usually involves one or more documents  
 # (usually at least one of these is ours), and one or more movements.  
 proceeding:  
         id (bigserial)  
         date (timestamp)  
   
 #       where the cashier was  
         branch -> entity  
   
 #       who was the cashier  
         responsable -> entity  
         :entry:  
   
 # own_document_proceeding  
   
 # when a proceeding involves one of our own documents.  
   
 own_document_proceeding:  
         id (bigserial)  
         proceeding -> proceeding  
         own_document -> own_document  
         amount (numeric(12,4))  
         :entry:  
   
 # alien_document_proceeding  
   
 # when a proceeding involves one of somebody else's documents.  
   
 alien_document_proceeding:  
         id (bigserial)  
         proceeding -> proceeding  
         alien_document -> alien_document  
         amount (numeric(12,4))  
         :entry:  
   
 # movement and movement_type  
   
 # this is the father of all movement_*.  
   
510  movement:  movement:
511          id (bigserial)      amount (numeric(12,4))
512          proceeding -> proceeding      proceeding -> proceeding
513        parent -> movement
514  #       sometimes a movement refers to a previous movement: for      movement_type -> movement_type
515  #       example, when one cheque is bad, so you write out a new one.      timestamp (timestamp)
516          parent -> movement      id (bigint)
         movement_type -> movement_type  
         amount (numeric(12,4))  
   
 movement_type:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
 # currency_type  
   
 # types of cash, with a rate that would be against one of them.  
   
 currency_type:  
         id (serial)  
         name (varchar(50))  
         rate (numeric(10,2))  
 # the format in which the currency values are shown. ie Dollar -> "U$D %2f"  
         format (varchar(50))  
         :account:  
         :history:  
   
 # currency_movement  
   
 # some kind of cash changeing hands  
   
 # is a movement  
   
 currency_movement(movement):  
         id (bigserial)  
   
 #       what kind of cash  
         currency_type -> currency_type  
         movement -> movement  
         :entry:  
   
 # bank_branch  
   
 # a bank branch is the thing you have accounts in  
   
 # is a persona  
   
 bank_branch(persona):  
         id (serial)  
         persona -> persona  
 #       you can get at this from entity_relation  
 #       bank -> bank  
         :history:  
   
 # Bank  
   
 # a bank, as an abstract persona that bank branches belong to. A bank is  
 # what you usually get morgages from, I think. At least my sister did :)  
   
 # is a persona  
   
 bank(persona):  
         id (serial)  
         name (varchar(80))  
         persona -> persona  
         :history:  
   
 # bank_account  
   
 # guess  
   
 bank_account:  
         id (serial)  
   
 #       the bank branch  
         bank_branch -> entity  
   
 #       how much we think we had in the bank  
         credit (numeric(12,4))  
   
 #       when we thought we knew  
         credit_timestamp (timestamp)  
   
 #       how much can I use in excess of my credit  
         overdraft (numeric(12,4))  
         :history:  
   
 # chequebook  
   
 # each time a bank gives us a chequebook due to us having an account  
 # with them, we write it down here.  
   
 # FIXME  
 # chequebook should probably have number, qty, stuff like that  
   
 chequebook:  
         id (serial)  
         account -> bank_account  
   
 # cheque  
   
 # When, how and why we used a cheque.  
   
 cheque:  
         id (bigserial)  
         chequebook -> chequebook  
         date (timestamp)  
         :account:  
         :entry:  
   
 # cheque_movement  
   
 cheque_movement(movement):  
         id (bigserial)  
   
         cheque -> cheque  
         movement -> movement  
         :entry:  
   
 # cheque_tax  
 cheque_tax:  
         id (bigserial)  
         cheque -> cheque  
         tax -> tax  
   
 # third_party_cheque  
   
 # other people's cheques  
   
517  third_party_cheque:  third_party_cheque:
518          id (bigserial)      bank_branch -> entity
519          bank_branch -> entity      entry -> entry
520  #       when the cheque is due      credit_date (timestamp)
521          credit_date (timestamp)      emmited_by (varchar(80))
522          emmited_by (varchar(80))      third_party_cheque_delay (int)
523  #       should be an educated guess      timestamp (timestamp)
524          _delay (int)      id (bigint)
525          :account:      account_plan -> account_plan
526          :entry:      :account:
527        :entry:
528  # third_party_cheque_movement  _alien_storehouse_data(alien_entity):
529        _start_t (timestamp)
530  third_party_cheque_movement(movement):      _end_t (timestamp)
531          id (bigserial)      _table -> alien_storehouse
532        _state -> __state__
533          third_party_cheque -> third_party_cheque      id (bigint)
534          movement -> movement      alien_entity -> alien_entity
535          :entry:      :history:
536    entity_attribute:
537  third_party_cheque_tax:      id (int)
538          id (bigserial)      :history:
539          third_party_cheque -> third_party_cheque  _persona_tax_profile_data:
540          tax -> tax      tax_profile -> tax_profile
541        persona -> entity
542  # bank_account_movement      _start_t (timestamp)
543        _end_t (timestamp)
544  # a movement between bank accounts (interdeposit)      _table -> persona_tax_profile
545        _state -> __state__
546  bank_account_movement(movement):      id (bigint)
547          id (bigserial)      :history:
548          origin -> bank_account  own_document:
549          destination -> bank_account      due_date (timestamp)
550          movement -> movement      timestamp (timestamp)
551  #       educated guess      own_document_type -> document_type
552          _delay (int)      related_to (varchar(255))
553        number (char(30))
554  # ticket      is_void (boolean)
555        salesperson -> entity
556  # "ticket canasta" et al      address (varchar(255))
557  # FIXME: this is empty, and it shouldn't be      date (timestamp)
558        authorized_amount (numeric(12,4))
559  ticket:      recipient -> entity
560          id (serial)      id (bigint)
561          ticket_type -> ticket_type      transport -> entity
562          :account:      end_timestamp (timestamp)
563          :history:      tax_total (numeric(12,4))
564        start_timestamp (timestamp)
565  # ticket_type      own_entity -> entity
566  ticket_type:      bundles (int)
567  #       the primary key      net_total (numeric(12,4))
568          id (serial)      observations (text)
569        discount_percent (numeric(12,4))
570  #       what is this ticket type?      authorized_by -> entity
571          name (varchar(80))      entry -> entry
572        guide_number (char(30))
573  #       that doesn't say a thing to me. Tell me more.      :entry:
574          description (text)  _employee_comm_prod_client_data:
575        commission -> commission
576  #       this table mirrors an entry in account_plan      product -> product
577          :account:      client -> entity
578        _start_t (timestamp)
579  #       this table has a history (or "transactional")      _end_t (timestamp)
580          :history:      employee -> entity
581        _table -> employee_comm_prod_client
582  # ticket_movement      _state -> __state__
583  ticket_movement(movement):      id (bigint)
584          id (bigserial)      :history:
585          ticket -> ticket  own_product_stock_item(own_item):
586          movement -> movement      own_item -> own_item
587          :entry:      observations (text)
588        timestamp (timestamp)
589  # obligation      difference (numeric(12,4))
590        product -> product
591  # legal documents, e.g. "I.O.U.s"      id (bigint)
592    erm_log:
593  # FIXME: this is incomplete      text (text)
594        id (int)
595        timestamp (timestamp)
596        erm -> erm
597    address:
598        id (int)
599        :history:
600    _task_priority_data:
601        _start_t (timestamp)
602        _end_t (timestamp)
603        _table -> task_priority
604        _state -> __state__
605        id (bigint)
606        name (varchar(80))
607        :history:
608  obligation:  obligation:
609          id (serial)      obligation_type -> obligation_type
610          date (timestamp)      amount (numeric(12,4))
611          amount (numeric(12,4))      date (timestamp)
612          obligation_type -> obligation_type      timestamp (timestamp)
613          :account:      account_plan -> account_plan
614        id (int)
615  # obligation_type      :account:
616  obligation_type:  own_storehouse(own_entity):
617  #       the primary key      id (int)
618          id (serial)      :history:
619    alien_document:
620  #       what is this obligation type?      due_date (timestamp)
621          name (varchar(80))      start_timestamp (timestamp)
622        sender -> entity
623  #       that doesn't say a thing to me. Tell me more.      alien_document_type -> document_type
624          description (text)      timestamp (timestamp)
625        tax_total (numeric(12,4))
626  #       this table mirrors an entry in account_plan      own_entity -> entity
627          :account:      bundles (int)
628        number (char(30))
629  #       this table has a history (or "transactional")      received_by -> entity
630          :history:      is_void (boolean)
631        net_total (numeric(12,4))
632  # obligation_movement      salesperson -> entity
633  obligation_movement(movement):      observations (text)
634          id (bigserial)      discount_percent (numeric(12,4))
635          obligation -> obligation      date (timestamp)
636          movement -> movement      entry -> entry
637          :entry:      guide_number (char(30))
638        id (bigint)
639  # credit_card      transport -> entity
640        end_timestamp (timestamp)
641  # e.g. VISA, etc.      :entry:
642    _product_tax_data:
643  # FIXME: this is incomplete      product -> product
644        _start_t (timestamp)
645  credit_card:      _end_t (timestamp)
646          id (serial)      entry -> entry
647          name (varchar(80))      _state -> __state__
648          ownid (serial)      _table -> product_tax
649          accreditation_account -> bank_account      tax -> tax
650          accreditation_date (timestamp)      amount (numeric(12,4))
651          :account:      id (bigint)
652          :history:      :entry:
653        :history:
654  # credit_card_plan  price_type:
655        id (int)
656  # when you buy something with plastic it's against a certain plan. Here.      :history:
657    country:
658        id (int)
659        :history:
660    _bank_branch_data(persona):
661        persona -> persona
662        _start_t (timestamp)
663        _end_t (timestamp)
664        _table -> bank_branch
665        _state -> __state__
666        id (bigint)
667        :history:
668    _address_data:
669        comment (varchar(80))
670        _table -> address
671        _start_t (timestamp)
672        _end_t (timestamp)
673        address (varchar(255))
674        address_type -> address_type
675        _state -> __state__
676        id (bigint)
677        entity -> entity
678        :history:
679  credit_card_plan:  credit_card_plan:
680          id (serial)      id (int)
681          credit_card -> credit_card      :account:
682          name (varchar(80))      :history:
683    product_measure_type:
684  #       how many installments      id (int)
685          payments (int)      :history:
686    _relation_type_data:
687  #       how much we are charged      _start_t (timestamp)
688          financial_charge (numeric(10,2))      _end_t (timestamp)
689        _table -> relation_type
690  #       how much we charge our customers      _state -> __state__
691          surcharge (numeric(10,2))      id (bigint)
692          :account:      name (varchar(255))
693          :history:      :history:
694    _physical_structure_data:
695  # Credit_card_movement      _start_t (timestamp)
696        name (varchar(80))
697  # when somebody pays with plastic, here is where.      parent -> physical_structure
698        _table -> physical_structure
699  credit_card_movement(movement):      _state -> __state__
700          id (bigserial)      id (bigint)
701          plan -> credit_card_plan      _end_t (timestamp)
702          movement -> movement      :history:
703          :entry:  _logical_structure_data:
704        _start_t (timestamp)
705  # Barter      name (varchar(80))
706        parent -> logical_structure
707  # FIXME barter is incomplete, probably (not implemented yet)      _table -> logical_structure
708        _state -> __state__
709  barter:      id (bigint)
710          id (serial)      _end_t (timestamp)
711          name (varchar(80))      :history:
712          barter_type -> barter_type  task_status:
713          :account:      id (int)
714          :history:      :history:
715    alien_storehouse(alien_entity):
716  # barter_type      id (int)
717        :history:
718    _currency_type_data:
719        rate (numeric(10,2))
720        _start_t (timestamp)
721        name (varchar(50))
722        format (varchar(50))
723        _table -> currency_type
724        _state -> __state__
725        account_plan -> account_plan
726        _end_t (timestamp)
727        id (bigint)
728        :account:
729        :history:
730    _country_data:
731        phone (integer)
732        iso3 (char(3))
733        iso2 (char(2))
734        _start_t (timestamp)
735        name (varchar(80))
736        _table -> country
737        un (integer)
738        _state -> __state__
739        id (bigint)
740        _end_t (timestamp)
741        :history:
742    employee_role:
743        id (int)
744        :history:
745    _fisco_data(persona):
746        persona -> persona
747        _start_t (timestamp)
748        _end_t (timestamp)
749        _table -> fisco
750        _state -> __state__
751        id (bigint)
752        :history:
753    ticket_type:
754        id (int)
755        :account:
756        :history:
757    employee_comm_prod:
758        id (bigint)
759        :history:
760    cheque:
761        chequebook -> chequebook
762        timestamp (timestamp)
763        date (timestamp)
764        entry -> entry
765        account_plan -> account_plan
766        id (bigint)
767        :account:
768        :entry:
769    own_pos_document:
770        id (int)
771        :history:
772    currency_type:
773        id (int)
774        :account:
775        :history:
776    bank_account_movement(movement):
777        origin -> bank_account
778        timestamp (timestamp)
779        bank_account_movement_delay (int)
780        destination -> bank_account
781        id (bigint)
782        movement -> movement
783    _task_status_data:
784        _start_t (timestamp)
785        _end_t (timestamp)
786        _table -> task_status
787        _state -> __state__
788        id (bigint)
789        name (varchar(80))
790        :history:
791    _file_data:
792        mimetype (char(80))
793        application (char(15))
794        _table -> file
795        _start_t (timestamp)
796        _end_t (timestamp)
797        checksum (char(32))
798        filename (varchar(255))
799        _state -> __state__
800        id (bigint)
801        size (int)
802        :history:
803    alien_item:
804        discount (numeric(12,4))
805        alien_document -> alien_document
806        entry -> entry
807        bonus (numeric(12,4))
808        timestamp (timestamp)
809        account_plan -> account_plan
810        id (bigint)
811        :account:
812        :entry:
813    alien_item_tax:
814        amount (numeric(12,4))
815        entry -> entry
816        timestamp (timestamp)
817        tax -> tax
818        id (bigint)
819        alien_item -> alien_item
820        :entry:
821    _credit_limit_data:
822        credit_limit (numeric(12,4))
823        _start_t (timestamp)
824        _end_t (timestamp)
825        movement_type -> movement_type
826        _table -> credit_limit
827        time_stamp (timestamp)
828        balance (numeric(12,4))
829        _state -> __state__
830        id (bigint)
831        entity -> entity
832        :history:
833    account_plan:
834        id (int)
835        :history:
836    _ticket_data:
837        _start_t (timestamp)
838        _end_t (timestamp)
839        ticket_type -> ticket_type
840        _table -> ticket
841        _state -> __state__
842        id (bigint)
843        account_plan -> account_plan
844        :account:
845        :history:
846    commission:
847        id (int)
848        :history:
849    sys_account2account_plan:
850        id (int)
851        :history:
852    document_relation_type:
853        timestamp (timestamp)
854        id (int)
855        name (varchar(80))
856    _entity_data:
857        _start_t (timestamp)
858        name (varchar(255))
859        is_active (boolean)
860        start_time (timestamp)
861        _state -> __state__
862        account_plan -> account_plan
863        anniversary (date)
864        observations (text)
865        _table -> entity
866        id (bigint)
867        _end_t (timestamp)
868        :account:
869        :history:
870    currency_movement(movement):
871        currency_type -> currency_type
872        entry -> entry
873        id (bigint)
874        timestamp (timestamp)
875        movement -> movement
876        :entry:
877    _own_entity_data(entity):
878        _start_t (timestamp)
879        _end_t (timestamp)
880        _table -> own_entity
881        _state -> __state__
882        id (bigint)
883        entity -> entity
884        :history:
885    comm_prod_client:
886        id (bigint)
887        :history:
888    cheque_tax:
889        timestamp (timestamp)
890        tax -> tax
891        id (bigint)
892        cheque -> cheque
893    _own_storehouse_data(own_entity):
894        _start_t (timestamp)
895        _end_t (timestamp)
896        own_entity -> own_entity
897        _table -> own_storehouse
898        _state -> __state__
899        id (bigint)
900        stock_by_invoice (boolean)
901        :history:
902  barter_type:  barter_type:
903  #       the primary key      id (int)
904          id (serial)      :account:
905        :history:
906  #       what is this barter type?  _product_store_data:
907          name (varchar(80))      hiwater (numeric(12,4))
908        product -> product
909  #       that doesn't say a thing to me. Tell me more.      lowater (numeric(12,4))
910          description (text)      _start_t (timestamp)
911        _end_t (timestamp)
912  #       this table mirrors an entry in account_plan      storehouse -> entity
913          :account:      _table -> product_store
914        level (numeric(12,4))
915  #       this table has a history (or "transactional")      _state -> __state__
916          :history:      id (bigint)
917        :history:
918  barter_movement(movement):  barter_movement(movement):
919          id (bigserial)      timestamp (timestamp)
920          barter -> barter      entry -> entry
921          movement -> movement      id (bigint)
922          :entry:      barter -> barter
923        movement -> movement
924  # account_plan      :entry:
925    _ticket_type_data:
926  # accounts (as in accounting) are categorized in a tree structure      _start_t (timestamp)
927  # presented here.      description (text)
928        id (bigint)
929  account_plan:      _table -> ticket_type
930          :account:      _state -> __state__
931          id (serial)      account_plan -> account_plan
932          name (varchar(80))      _end_t (timestamp)
933          parent -> account_plan      name (varchar(80))
934          :history:      :account:
935        :history:
936  # logical_structure  obligation_type:
937        id (int)
938  # logical_structure is a hierarchical tree that lets us know what      :account:
939  # exactly that.      :history:
940    tax_profile:
941  logical_structure:      id (int)
942          id (serial)      :history:
943          parent -> logical_structure  credit_limit:
944          name (varchar(80))      id (int)
945          :history:      :history:
946    _provider_data(persona):
947  # Physical_structure      persona -> persona
948        _start_t (timestamp)
949  # a hierarchical tree that reflects the actual, physical, structure of      _end_t (timestamp)
950  # the organization, as in buildings, rooms, etc.      _table -> provider
951        _state -> __state__
952  physical_structure:      id (bigint)
953          id (serial)      :history:
954          parent -> physical_structure  employee_comm_client:
955          name (varchar(80))      id (bigint)
956          :history:      :history:
957    own_product_item(own_item):
958  # logical2physical      own_item -> own_item
959        account_plan -> account_plan
960  # what logical structures are contained in which physical structures (or      entry -> entry
961  # viceversa)      timestamp (timestamp)
962        price -> price
963        id (bigint)
964        unit_price (numeric(12,4))
965        qty (numeric(12,4))
966        :account:
967        :entry:
968  logical2physical:  logical2physical:
969          id (serial)      id (int)
970          logical -> logical_structure      :history:
971          physical -> physical_structure  organization(own_entity):
972          :history:      id (int)
973        :history:
974  # Entry  _barter_data:
975        _start_t (timestamp)
976  # an entry is a line in the main ledger      name (varchar(80))
977        _state -> __state__
978  entry:      _table -> barter
979          :entry:      barter_type -> barter_type
980          id (bigserial)      account_plan -> account_plan
981          date (timestamp)      _end_t (timestamp)
982          cost_center -> logical_structure      id (bigint)
983        :account:
984  # Commission      :history:
985    entity_relation:
986  #         commission for                  documented in      id (int)
987  #         ~~~~~~~~~~ ~~~                  ~~~~~~~~~~ ~~      :history:
988  #         employee                        employee  _price_type_data:
989  #         client                          client      _start_t (timestamp)
990  #         product                         product      name (varchar(80))
991  #         employee x client               employee_comm_client      parent -> price_type
992  #         employee x product              employee_comm_prod      is_active (boolean)
993  #         client x product                comm_prod_client      _state -> __state__
994  #         employee x product x client     employee_comm_prod_client      id (bigint)
995        branch -> entity
996  commission:      formula (text)
997          id (serial)      end_date (timestamp)
998          name (varchar(80))      _table -> price_type
999          rule (text)      start_date (timestamp)
1000          :history:      _end_t (timestamp)
1001        :history:
1002  # Country  obligation_movement(movement):
1003        timestamp (timestamp)
1004  # list of countries      obligation -> obligation
1005        entry -> entry
1006  country:      id (bigint)
1007          id (serial)      movement -> movement
1008  #       canonical name of the country (ISO name?)      :entry:
1009          name (varchar(80))  _organization_data(own_entity):
1010  #       UN code for the country      _start_t (timestamp)
1011          un (integer)      _end_t (timestamp)
1012  #       ISO-3316-1 alpha-2 code      own_entity -> own_entity
1013          iso2 (char(2))      _table -> organization
1014  #       ISO-3316-1 alpha-3 code      _state -> __state__
1015          iso3 (char(3))      id (bigint)
1016  #       ITU code      :history:
1017          phone (integer)  category_attribute:
1018          :history:      id (int)
1019        :history:
   
 #  ERM : to manage the relatinship between entities  
   
   
 task:  
         id (serial)  
         name (varchar(80))  
         parent -> task  
         task_type -> task_type  
         task_priority -> task_priority  
         task_status -> task_status  
         assigned_to -> entity  
         assigned_by -> entity  
         assigned_time  (timestamp)  
         planned_start_time  (timestamp)  
         planned_end_time (timestamp)  
   
 task_type:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
 task_priority:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
 task_status:  
         id (serial)  
         name (varchar(80))  
         :history:  
   
   
   
   
 #       former task_victims    
   
 task_recipient:  
         id (serial)  
         task -> task  
         to_make_to -> entity  
   
 erm_task:  
         id (serial)  
         task -> task  
         erm -> erm  
   
1020  erm:  erm:
1021          id (serial)      erm_type -> erm_type
1022          description (varchar(80))      description (varchar(80))
1023          time  (timestamp)      time (timestamp)
1024          erm_type -> erm_type      timestamp (timestamp)
1025          made_by -> entity      made_by -> entity
1026        id (int)
1027  erm_type:  entity_types:
1028          id (serial)      id (int)
1029          name (varchar(80))      :history:
1030          :history:  _entity_uid_type_data:
1031        _start_t (timestamp)
1032        _end_t (timestamp)
1033        _table -> entity_uid_type
1034        _state -> __state__
1035        id (bigint)
1036        name (varchar(255))
1037        :history:
1038    _comm_prod_client_data:
1039        commission -> commission
1040        product -> product
1041        client -> entity
1042        _start_t (timestamp)
1043        _end_t (timestamp)
1044        _table -> comm_prod_client
1045        _state -> __state__
1046        id (bigint)
1047        :history:
1048    ticket_movement(movement):
1049        timestamp (timestamp)
1050        ticket -> ticket
1051        entry -> entry
1052        id (bigint)
1053        movement -> movement
1054        :entry:
1055    _product_code_type_data:
1056        _start_t (timestamp)
1057        _end_t (timestamp)
1058        _table -> product_code_type
1059        _state -> __state__
1060        id (bigint)
1061        name (varchar(80))
1062        :history:
1063    erm_file:
1064        erm -> erm
1065        id (int)
1066        file -> file
1067        timestamp (timestamp)
1068    _task_type_data:
1069        _start_t (timestamp)
1070        _end_t (timestamp)
1071        _table -> task_type
1072        _state -> __state__
1073        id (bigint)
1074        name (varchar(80))
1075        :history:
1076    third_party_cheque_movement(movement):
1077        timestamp (timestamp)
1078        third_party_cheque -> third_party_cheque
1079        entry -> entry
1080        id (bigint)
1081        movement -> movement
1082        :entry:
1083    tax:
1084        id (int)
1085        :account:
1086        :history:
1087  erm_entity:  erm_entity:
1088          id (serial)      erm -> erm
1089          erm -> erm      id (int)
1090  # apunta a entity types para poder discriminarlo por el      made_to -> entity_types
1091  # tipo de entidad  que se lo esta registrando      timestamp (timestamp)
1092  # en el caso de que la entidad tenga  más de un tipo  _contact_data(alien_entity):
1093          made_to -> entity_types      _start_t (timestamp)
1094        _end_t (timestamp)
1095  erm_log:      _table -> contact
1096          id (serial)      _state -> __state__
1097          erm -> erm      id (bigint)
1098          text (text)      alien_entity -> alien_entity
1099        :history:
1100    _entity_types_data:
1101        _start_t (timestamp)
1102        _end_t (timestamp)
1103        entity_type -> entity_type
1104        _table -> entity_types
1105        _state -> __state__
1106        id (bigint)
1107        entity -> entity
1108        :history:
1109    _own_pos_document_data:
1110        document_type -> document_type
1111        _start_t (timestamp)
1112        _end_t (timestamp)
1113        print_command (varchar(255))
1114        _state -> __state__
1115        _table -> own_pos_document
1116        own_pos -> entity
1117        id (bigint)
1118        number (char(30))
1119        :history:
1120    __papo__:
1121        date (timestamp)
1122        value (varchar(255))
1123        key (varchar(255))
1124    file:
1125        id (int)
1126        :history:
1127    _product_name_type_data:
1128        is_required (boolean)
1129        _start_t (timestamp)
1130        name (varchar(80))
1131        _table -> product_name_type
1132        _state -> __state__
1133        id (bigint)
1134        _end_t (timestamp)
1135        :history:
1136    own_entity(entity):
1137        id (int)
1138        :history:
1139    _credit_card_plan_data:
1140        _start_t (timestamp)
1141        name (varchar(80))
1142        financial_charge (numeric(10,2))
1143        _state -> __state__
1144        account_plan -> account_plan
1145        credit_card -> credit_card
1146        payments (int)
1147        _table -> credit_card_plan
1148        id (bigint)
1149        _end_t (timestamp)
1150        surcharge (numeric(10,2))
1151        :account:
1152        :history:
1153    _product_structure_data:
1154        product -> product
1155        _start_t (timestamp)
1156        _end_t (timestamp)
1157        _state -> __state__
1158        _table -> product_structure
1159        component -> product
1160        id (bigint)
1161        qty (numeric(12,4))
1162        :history:
1163    alien_doc4alien_doc:
1164        document_to -> alien_document
1165        timestamp (timestamp)
1166        id (int)
1167        relation_type -> document_relation_type
1168        document_from -> alien_document
1169    alien_entity(entity):
1170        id (int)
1171        :history:
1172    _employee_role_data:
1173        _start_t (timestamp)
1174        _end_t (timestamp)
1175        employee -> entity
1176        role -> role
1177        _table -> employee_role
1178        _state -> __state__
1179        id (bigint)
1180        :history:
1181    __state__:
1182        state (varchar(40))
1183        id (int)
1184    _erm_type_data:
1185        _start_t (timestamp)
1186        _end_t (timestamp)
1187        _table -> erm_type
1188        _state -> __state__
1189        id (bigint)
1190        name (varchar(80))
1191        :history:
1192    _sys_account2account_plan_data:
1193        account -> account_plan
1194        code (varchar(40))
1195        _start_t (timestamp)
1196        name (varchar(40))
1197        _table -> sys_account2account_plan
1198        _state -> __state__
1199        id (bigint)
1200        _end_t (timestamp)
1201        :history:
1202    client(persona):
1203        id (int)
1204        :history:
1205    role:
1206        id (int)
1207        :history:
1208    product_name_type:
1209        id (int)
1210        :history:
1211    _address_type_data:
1212        _start_t (timestamp)
1213        _end_t (timestamp)
1214        _table -> address_type
1215        _state -> __state__
1216        id (bigint)
1217        name (varchar(80))
1218        :history:
1219    product_name:
1220        id (int)
1221        :history:
1222    _persona_data(alien_entity):
1223        _start_t (timestamp)
1224        _end_t (timestamp)
1225        _table -> persona
1226        _state -> __state__
1227        id (bigint)
1228        alien_entity -> alien_entity
1229        :history:
1230    product:
1231        id (int)
1232        :account:
1233        :history:
1234    persona(alien_entity):
1235        id (int)
1236        :history:
1237    _entity_currency_type_data:
1238        currency_type -> currency_type
1239        _start_t (timestamp)
1240        _end_t (timestamp)
1241        _table -> entity_currency_type
1242        _state -> __state__
1243        id (bigint)
1244        entity -> entity
1245        :history:
1246    _product_classification_data:
1247        _end_t (timestamp)
1248        _start_t (timestamp)
1249        name (varchar(255))
1250        parent -> product_classification
1251        _table -> product_classification
1252        _state -> __state__
1253        id (bigint)
1254        is_product (boolean)
1255        description (text)
1256        :history:
1257    _entity_uid_data:
1258        _end_t (timestamp)
1259        _start_t (timestamp)
1260        uid (varchar(50))
1261        _table -> entity_uid
1262        _state -> __state__
1263        id (bigint)
1264        entity_uid_type -> entity_uid_type
1265        entity -> entity
1266        :history:
1267    price:
1268        id (bigint)
1269        :history:
1270    _commission_data:
1271        _start_t (timestamp)
1272        name (varchar(80))
1273        _table -> commission
1274        _state -> __state__
1275        id (bigint)
1276        rule (text)
1277        _end_t (timestamp)
1278        :history:
1279    _client_data(persona):
1280        commission -> commission
1281        score (int)
1282        _start_t (timestamp)
1283        _end_t (timestamp)
1284        price_type -> price_type
1285        _table -> client
1286        _state -> __state__
1287        id (bigint)
1288        persona -> persona
1289        :history:
1290    relation_type:
1291        id (int)
1292        :history:
1293    credit_card:
1294        id (int)
1295        :account:
1296        :history:
1297    chequebook:
1298        timestamp (timestamp)
1299        account -> bank_account
1300        id (int)
1301    erm_type:
1302        id (int)
1303        :history:
1304    own_descriptive_item(own_item):
1305        amount (numeric(12,4))
1306        description (text)
1307        entry -> entry
1308        id (bigint)
1309        timestamp (timestamp)
1310        own_item -> own_item
1311        account_plan -> account_plan
1312        :account:
1313        :entry:
1314    _category_type_data:
1315        _start_t (timestamp)
1316        _end_t (timestamp)
1317        _table -> category_type
1318        _state -> __state__
1319        id (bigint)
1320        name (varchar(80))
1321        :history:
1322    entry:
1323        date (timestamp)
1324        timestamp (timestamp)
1325        cost_center -> logical_structure
1326        id (bigint)
1327        entry -> entry
1328        :entry:
1329    _barter_type_data:
1330        _start_t (timestamp)
1331        description (text)
1332        id (bigint)
1333        _table -> barter_type
1334        _state -> __state__
1335        account_plan -> account_plan
1336        _end_t (timestamp)
1337        name (varchar(80))
1338        :account:
1339        :history:
1340    own_document_proceeding:
1341        amount (numeric(12,4))
1342        proceeding -> proceeding
1343        entry -> entry
1344        own_document -> own_document
1345        timestamp (timestamp)
1346        id (bigint)
1347        :entry:
1348    entity_currency_type:
1349        id (int)
1350        :history:
1351    fisco(persona):
1352        id (int)
1353        :history:
1354    _product_provider_data:
1355        product -> product
1356        _start_t (timestamp)
1357        catalog_number (char(30))
1358        provider -> entity
1359        _table -> product_provider
1360        _state -> __state__
1361        id (bigint)
1362        _end_t (timestamp)
1363        :history:
1364    task:
1365        assigned_time (timestamp)
1366        task_type -> task_type
1367        name (varchar(80))
1368        parent -> task
1369        assigned_by -> entity
1370        timestamp (timestamp)
1371        task_priority -> task_priority
1372        planned_start_time (timestamp)
1373        assigned_to -> entity
1374        task_status -> task_status
1375        planned_end_time (timestamp)
1376        id (int)
1377    _category_attribute_data:
1378        category_type -> category_type
1379        _start_t (timestamp)
1380        name (varchar(80))
1381        _table -> category_attribute
1382        _state -> __state__
1383        id (bigint)
1384        _end_t (timestamp)
1385        :history:
1386    product_file:
1387        id (bigint)
1388        :history:
1389    product_measure:
1390        id (int)
1391        :history:
1392    contact(alien_entity):
1393        id (int)
1394        :history:
1395    product_tax:
1396        id (bigint)
1397        :entry:
1398        :history:
1399    __papo_patches__:
1400        date (timestamp)
1401        patch (varchar(255))
1402    _movement_type_data:
1403        _start_t (timestamp)
1404        _end_t (timestamp)
1405        _table -> movement_type
1406        _state -> __state__
1407        id (bigint)
1408        name (varchar(80))
1409        :history:
1410    entity_uid_type:
1411        id (int)
1412        :history:
1413    
 erm_file:  
         id (serial)  
         erm -> erm  
         file -> file  

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26