diff options
Diffstat (limited to 'doc/database/ledgersmb.xml')
-rw-r--r-- | doc/database/ledgersmb.xml | 3016 |
1 files changed, 2541 insertions, 475 deletions
diff --git a/doc/database/ledgersmb.xml b/doc/database/ledgersmb.xml index 82672ad6..6fc88fa1 100644 --- a/doc/database/ledgersmb.xml +++ b/doc/database/ledgersmb.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!-- $Header: /cvsroot/autodoc/autodoc/xml.tmpl,v 1.2 2006/05/16 19:01:27 rbt Exp $ --> -<book id="database.ledgersmb" xreflabel="ledgersmb database schema"><title>ledgersmb Model</title> +<book id="database.lsmb13-new" xreflabel="lsmb13-new database schema"><title>lsmb13-new Model</title> @@ -297,7 +297,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -310,8 +310,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -356,7 +354,7 @@ </varlistentry> <varlistentry> - <term><structfield>vendor_id</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> <type>integer</type> @@ -366,6 +364,18 @@ + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> + + <para> + Used to be customer_id, but customer is now metadata. You need to push to entity </para> </listitem> @@ -536,7 +546,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -546,6 +556,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -705,13 +725,6 @@ <title>Indexes on ap</title> <varlistentry> - <term>ap_employee_id_key</term> - <listitem><para>employee_id</para></listitem> - </varlistentry> - - - - <varlistentry> <term>ap_id_key</term> <listitem><para>id</para></listitem> </varlistentry> @@ -744,13 +757,6 @@ <listitem><para>transdate</para></listitem> </varlistentry> - - - <varlistentry> - <term>ap_vendor_id_key</term> - <listitem><para>vendor_id</para></listitem> - </varlistentry> - </variablelist> @@ -783,7 +789,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -796,8 +802,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -842,7 +846,7 @@ </varlistentry> <varlistentry> - <term><structfield>customer_id</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> <type>integer</type> @@ -852,6 +856,18 @@ + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> + + <para> + Used to be customer_id, but customer is now metadata. You need to push to entity </para> </listitem> @@ -1052,7 +1068,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -1062,6 +1078,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -1189,20 +1215,6 @@ <title>Indexes on ar</title> <varlistentry> - <term>ar_customer_id_key</term> - <listitem><para>customer_id</para></listitem> - </varlistentry> - - - - <varlistentry> - <term>ar_employee_id_key</term> - <listitem><para>employee_id</para></listitem> - </varlistentry> - - - - <varlistentry> <term>ar_id_key</term> <listitem><para>id</para></listitem> </varlistentry> @@ -1504,7 +1516,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -1514,6 +1526,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -1590,7 +1612,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -1603,8 +1625,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -1680,7 +1700,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -1693,8 +1713,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -1900,12 +1918,12 @@ </para> </section> - <section id="public.table.custom-field-catalog" - xreflabel="public.custom_field_catalog"> - <title id="public.table.custom-field-catalog-title"> + <section id="public.table.company" + xreflabel="public.company"> + <title id="public.table.company-title"> Table: - <structname>custom_field_catalog</structname> + <structname>company</structname> </title> @@ -1913,16 +1931,68 @@ <para> <variablelist> <title> - Structure of <structname>custom_field_catalog</structname> + Structure of <structname>company</structname> </title> <varlistentry> - <term><structfield>field_id</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> <type>serial</type> + + + <literal>UNIQUE</literal> + + + + + <literal>NOT NULL</literal> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>entity_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>legal_name</structfield></term> + <listitem><para> + <type>text</type> + + <literal>PRIMARY KEY</literal> @@ -1943,7 +2013,7 @@ </varlistentry> <varlistentry> - <term><structfield>table_id</structfield></term> + <term><structfield>entity_class_id</structfield></term> <listitem><para> <type>integer</type> @@ -1953,12 +2023,14 @@ + <literal>NOT NULL</literal> - <literal>REFERENCES</literal> <xref linkend="public.table.custom-table-catalog"/> + + <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/> </para> @@ -1967,7 +2039,44 @@ </varlistentry> <varlistentry> - <term><structfield>field_name</structfield></term> + <term><structfield>primary_location_id</structfield></term> + <listitem><para> + <type>integer</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.location"/> + + + </para> + + <para> + This is the location that should show up by default for any forms + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>tax_id</structfield></term> <listitem><para> <type>text</type> @@ -1979,6 +2088,10 @@ </para> + <para> + In the US this would be a EIN. + </para> + </listitem> </varlistentry> @@ -1986,7 +2099,50 @@ + <variablelist> + <title>Constraints on company</title> + + <varlistentry> + <term>company_legal_name_check</term> + <listitem><para>CHECK ((legal_name ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing company_to_contact via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.company-to-contact"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.company-to-entity"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.company-to-location"/> + </para> + </listitem> + </itemizedlist> @@ -1996,27 +2152,35 @@ </para> </section> - <section id="public.table.custom-table-catalog" - xreflabel="public.custom_table_catalog"> - <title id="public.table.custom-table-catalog-title"> + <section id="public.table.company-to-contact" + xreflabel="public.company_to_contact"> + <title id="public.table.company-to-contact-title"> Table: - <structname>custom_table_catalog</structname> + <structname>company_to_contact</structname> </title> + <para> + To keep track of the relationship between multiple contact methods and a single company + </para> + <para> <variablelist> <title> - Structure of <structname>custom_table_catalog</structname> + Structure of <structname>company_to_contact</structname> </title> <varlistentry> - <term><structfield>table_id</structfield></term> + <term><structfield>company_id</structfield></term> <listitem><para> - <type>serial</type> + <type>integer</type> + + + + <literal>PRIMARY KEY</literal> @@ -2032,6 +2196,10 @@ + <literal>REFERENCES</literal> <xref linkend="public.table.company"/> + + + </para> @@ -2039,11 +2207,53 @@ </varlistentry> <varlistentry> - <term><structfield>extends</structfield></term> + <term><structfield>contact_class_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>contact</structfield></term> <listitem><para> <type>text</type> + <literal>PRIMARY KEY</literal> + + + + + + + + @@ -2054,8 +2264,117 @@ </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Constraints on company_to_contact</title> + + <varlistentry> + <term>company_to_contact_contact_check</term> + <listitem><para>CHECK ((contact ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.company-to-entity" + xreflabel="public.company_to_entity"> + <title id="public.table.company-to-entity-title"> + Table: + + <structname>company_to_entity</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>company_to_entity</structname> + </title> + + <varlistentry> - <term><structfield>table_name</structfield></term> + <term><structfield>company_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.company"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>entity_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>related_how</structfield></term> <listitem><para> <type>text</type> @@ -2070,26 +2389,43 @@ </listitem> </varlistentry> + <varlistentry> + <term><structfield>created</structfield></term> + <listitem><para> + <type>date</type> + + + + <literal>NOT NULL</literal> + + + + <literal>DEFAULT ('now'::text)::date</literal> + + + + </para> + + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <title>Constraints on company_to_entity</title> + <varlistentry> + <term>company_to_entity_check</term> + <listitem><para>CHECK ((entity_id <> company_id))</para></listitem> + </varlistentry> + </variablelist> - <itemizedlist> - <title> - Tables referencing custom_field_catalog via Foreign Key Constraints - </title> - <listitem> - <para> - <xref linkend="public.table.custom-field-catalog"/> - </para> - </listitem> - </itemizedlist> @@ -2099,12 +2435,12 @@ </para> </section> - <section id="public.table.customer" - xreflabel="public.customer"> - <title id="public.table.customer-title"> + <section id="public.table.company-to-location" + xreflabel="public.company_to_location"> + <title id="public.table.company-to-location-title"> Table: - <structname>customer</structname> + <structname>company_to_location</structname> </title> @@ -2112,16 +2448,20 @@ <para> <variablelist> <title> - Structure of <structname>customer</structname> + Structure of <structname>company_to_location</structname> </title> <varlistentry> - <term><structfield>id</structfield></term> + <term><structfield>location_id</structfield></term> <listitem><para> <type>integer</type> + + + + <literal>PRIMARY KEY</literal> @@ -2132,10 +2472,12 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> + <literal>REFERENCES</literal> <xref linkend="public.table.location"/> + + </para> @@ -2144,14 +2486,31 @@ </varlistentry> <varlistentry> - <term><structfield>name</structfield></term> + <term><structfield>company_id</structfield></term> <listitem><para> - <type>character varying(64)</type> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.company"/> + + </para> @@ -2159,10 +2518,51 @@ </listitem> </varlistentry> + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.contact-class" + xreflabel="public.contact_class"> + <title id="public.table.contact-class-title"> + Table: + + <structname>contact_class</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>contact_class</structname> + </title> + + <varlistentry> - <term><structfield>address1</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>serial</type> + + + + + <literal>UNIQUE</literal> + + + + + <literal>NOT NULL</literal> @@ -2176,9 +2576,18 @@ </varlistentry> <varlistentry> - <term><structfield>address2</structfield></term> + <term><structfield>class</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>text</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -2191,10 +2600,85 @@ </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Constraints on contact_class</title> + + <varlistentry> + <term>contact_class_class_check</term> + <listitem><para>CHECK (("class" ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing company_to_contact via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.company-to-contact"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-contact"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.country" + xreflabel="public.country"> + <title id="public.table.country-title"> + Table: + + <structname>country</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>country</structname> + </title> + + <varlistentry> - <term><structfield>city</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -2208,12 +2692,14 @@ </varlistentry> <varlistentry> - <term><structfield>state</structfield></term> + <term><structfield>name</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>text</type> + <literal>NOT NULL</literal> + @@ -2224,12 +2710,14 @@ </varlistentry> <varlistentry> - <term><structfield>zipcode</structfield></term> + <term><structfield>short_name</structfield></term> <listitem><para> - <type>character varying(10)</type> + <type>text</type> + <literal>NOT NULL</literal> + @@ -2240,9 +2728,9 @@ </varlistentry> <varlistentry> - <term><structfield>country</structfield></term> + <term><structfield>itu</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>text</type> @@ -2252,13 +2740,91 @@ </para> + <para> + The ITU Telecommunication Standardization Sector code for calling internationally. For example, the US is 1, Great Britain is 44 + </para> + </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Constraints on country</title> + + <varlistentry> + <term>country_name_check</term> + <listitem><para>CHECK ((name ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + + + <varlistentry> + <term>country_short_name_check</term> + <listitem><para>CHECK ((short_name ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing location via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.location"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.custom-field-catalog" + xreflabel="public.custom_field_catalog"> + <title id="public.table.custom-field-catalog-title"> + Table: + + <structname>custom_field_catalog</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>custom_field_catalog</structname> + </title> + + <varlistentry> - <term><structfield>contact</structfield></term> + <term><structfield>field_id</structfield></term> <listitem><para> - <type>character varying(64)</type> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -2272,9 +2838,12 @@ </varlistentry> <varlistentry> - <term><structfield>phone</structfield></term> + <term><structfield>table_id</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>integer</type> + + + @@ -2282,15 +2851,76 @@ + + + <literal>REFERENCES</literal> <xref linkend="public.table.custom-table-catalog"/> + + </para> </listitem> </varlistentry> <varlistentry> - <term><structfield>fax</structfield></term> + <term><structfield>field_name</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>text</type> + + + + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.custom-table-catalog" + xreflabel="public.custom_table_catalog"> + <title id="public.table.custom-table-catalog-title"> + Table: + + <structname>custom_table_catalog</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>custom_table_catalog</structname> + </title> + + + <varlistentry> + <term><structfield>table_id</structfield></term> + <listitem><para> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -2304,7 +2934,7 @@ </varlistentry> <varlistentry> - <term><structfield>email</structfield></term> + <term><structfield>extends</structfield></term> <listitem><para> <type>text</type> @@ -2320,7 +2950,7 @@ </varlistentry> <varlistentry> - <term><structfield>notes</structfield></term> + <term><structfield>table_name</structfield></term> <listitem><para> <type>text</type> @@ -2335,10 +2965,69 @@ </listitem> </varlistentry> + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing custom_field_catalog via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.custom-field-catalog"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.customer" + xreflabel="public.customer"> + <title id="public.table.customer-title"> + Table: + + <structname>customer</structname> + </title> + + + <para> + This is now a metadata table that holds information specific to customers. Source info is not part of the entity management + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>customer</structname> + </title> + + <varlistentry> - <term><structfield>discount</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> - <type>numeric</type> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -2352,25 +3041,35 @@ </varlistentry> <varlistentry> - <term><structfield>taxincluded</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> - <type>boolean</type> + <type>integer</type> + + + + + + - <literal>DEFAULT false</literal> + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> </para> + <para> + This is the relationship between entities and customers + </para> + </listitem> </varlistentry> <varlistentry> - <term><structfield>creditlimit</structfield></term> + <term><structfield>discount</structfield></term> <listitem><para> <type>numeric</type> @@ -2386,14 +3085,16 @@ </varlistentry> <varlistentry> - <term><structfield>terms</structfield></term> + <term><structfield>taxincluded</structfield></term> <listitem><para> - <type>smallint</type> + <type>boolean</type> + <literal>DEFAULT false</literal> + </para> @@ -2402,9 +3103,9 @@ </varlistentry> <varlistentry> - <term><structfield>customernumber</structfield></term> + <term><structfield>creditlimit</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>numeric</type> @@ -2418,9 +3119,9 @@ </varlistentry> <varlistentry> - <term><structfield>cc</structfield></term> + <term><structfield>terms</structfield></term> <listitem><para> - <type>text</type> + <type>smallint</type> @@ -2434,9 +3135,9 @@ </varlistentry> <varlistentry> - <term><structfield>bcc</structfield></term> + <term><structfield>customernumber</structfield></term> <listitem><para> - <type>text</type> + <type>character varying(32)</type> @@ -2450,9 +3151,9 @@ </varlistentry> <varlistentry> - <term><structfield>business_id</structfield></term> + <term><structfield>cc</structfield></term> <listitem><para> - <type>integer</type> + <type>text</type> @@ -2466,9 +3167,9 @@ </varlistentry> <varlistentry> - <term><structfield>taxnumber</structfield></term> + <term><structfield>bcc</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>text</type> @@ -2482,9 +3183,9 @@ </varlistentry> <varlistentry> - <term><structfield>sic_code</structfield></term> + <term><structfield>business_id</structfield></term> <listitem><para> - <type>character varying(6)</type> + <type>integer</type> @@ -2498,9 +3199,9 @@ </varlistentry> <varlistentry> - <term><structfield>iban</structfield></term> + <term><structfield>sic_code</structfield></term> <listitem><para> - <type>character varying(34)</type> + <type>character varying(6)</type> @@ -2514,9 +3215,9 @@ </varlistentry> <varlistentry> - <term><structfield>bic</structfield></term> + <term><structfield>iban</structfield></term> <listitem><para> - <type>character varying(11)</type> + <type>character varying(34)</type> @@ -2530,9 +3231,9 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>bic</structfield></term> <listitem><para> - <type>integer</type> + <type>character varying(11)</type> @@ -2602,6 +3303,8 @@ + <literal>DEFAULT ('now'::text)::date</literal> + </para> @@ -2625,22 +3328,31 @@ </listitem> </varlistentry> - </variablelist> + <varlistentry> + <term><structfield>invoice_notes</structfield></term> + <listitem><para> + <type>text</type> - <variablelist> - <title>Indexes on customer</title> - <varlistentry> - <term>customer_contact_key</term> - <listitem><para>lower((contact)::text)</para></listitem> + + </para> + + </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Indexes on customer</title> + <varlistentry> <term>customer_customernumber_key</term> <listitem><para>customernumber</para></listitem> @@ -2653,13 +3365,6 @@ <listitem><para>id</para></listitem> </varlistentry> - - - <varlistentry> - <term>customer_name_key</term> - <listitem><para>lower((name)::text)</para></listitem> - </varlistentry> - </variablelist> @@ -2857,7 +3562,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -2870,8 +3575,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -3022,6 +3725,10 @@ </title> + <para> + Is a metadata table specific to employees + </para> + <para> <variablelist> @@ -3033,7 +3740,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -3046,11 +3753,35 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>entity_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + </para> @@ -3074,13 +3805,15 @@ </varlistentry> <varlistentry> - <term><structfield>name</structfield></term> + <term><structfield>startdate</structfield></term> <listitem><para> - <type>character varying(64)</type> + <type>date</type> + + <literal>DEFAULT ('now'::text)::date</literal> @@ -3090,9 +3823,9 @@ </varlistentry> <varlistentry> - <term><structfield>address1</structfield></term> + <term><structfield>enddate</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>date</type> @@ -3106,9 +3839,9 @@ </varlistentry> <varlistentry> - <term><structfield>address2</structfield></term> + <term><structfield>notes</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>text</type> @@ -3122,9 +3855,9 @@ </varlistentry> <varlistentry> - <term><structfield>city</structfield></term> + <term><structfield>role</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>character varying(20)</type> @@ -3138,14 +3871,16 @@ </varlistentry> <varlistentry> - <term><structfield>state</structfield></term> + <term><structfield>sales</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>boolean</type> + <literal>DEFAULT false</literal> + </para> @@ -3154,9 +3889,9 @@ </varlistentry> <varlistentry> - <term><structfield>zipcode</structfield></term> + <term><structfield>ssn</structfield></term> <listitem><para> - <type>character varying(10)</type> + <type>character varying(20)</type> @@ -3170,9 +3905,9 @@ </varlistentry> <varlistentry> - <term><structfield>country</structfield></term> + <term><structfield>iban</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>character varying(34)</type> @@ -3186,9 +3921,9 @@ </varlistentry> <varlistentry> - <term><structfield>workphone</structfield></term> + <term><structfield>bic</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>character varying(11)</type> @@ -3202,9 +3937,9 @@ </varlistentry> <varlistentry> - <term><structfield>homephone</structfield></term> + <term><structfield>managerid</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>integer</type> @@ -3218,16 +3953,14 @@ </varlistentry> <varlistentry> - <term><structfield>startdate</structfield></term> + <term><structfield>employeenumber</structfield></term> <listitem><para> - <type>date</type> + <type>character varying(32)</type> - <literal>DEFAULT ('now'::text)::date</literal> - </para> @@ -3236,7 +3969,7 @@ </varlistentry> <varlistentry> - <term><structfield>enddate</structfield></term> + <term><structfield>dob</structfield></term> <listitem><para> <type>date</type> @@ -3251,10 +3984,54 @@ </listitem> </varlistentry> + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.entity" + xreflabel="public.entity"> + <title id="public.table.entity-title"> + Table: + + <structname>entity</structname> + </title> + + + <para> + The primary entity table to map to all contacts + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>entity</structname> + </title> + + <varlistentry> - <term><structfield>notes</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> - <type>text</type> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + @@ -3268,43 +4045,219 @@ </varlistentry> <varlistentry> - <term><structfield>role</structfield></term> + <term><structfield>name</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>text</type> + + </para> + <para> + This is the common name of an entity. If it was a person it may be Joshua Drake, a company Acme Corp. You may also choose to use a domain such as commandprompt.com </para> </listitem> </varlistentry> <varlistentry> - <term><structfield>sales</structfield></term> + <term><structfield>entity_class</structfield></term> <listitem><para> - <type>boolean</type> + <type>integer</type> - <literal>DEFAULT false</literal> + + + <literal>NOT NULL</literal> + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/> + + </para> </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Constraints on entity</title> + + <varlistentry> + <term>entity_name_check</term> + <listitem><para>CHECK ((name ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing ap via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.ap"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.ar"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.company"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.company-to-entity"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.customer"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.employee"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.entity-class-to-entity"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.entity-other-name"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.oe"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.partsvendor"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-entity"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.vendor"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.entity-class" + xreflabel="public.entity_class"> + <title id="public.table.entity-class-title"> + Table: + + <structname>entity_class</structname> + </title> + + + <para> + Defines the class type such as vendor, customer, contact, employee + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>entity_class</structname> + </title> + + <varlistentry> - <term><structfield>email</structfield></term> + <term><structfield>id</structfield></term> <listitem><para> - <type>text</type> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + @@ -3312,18 +4265,27 @@ + + + + </para> + + <para> + The first 7 values are reserved and permanent </para> </listitem> </varlistentry> <varlistentry> - <term><structfield>ssn</structfield></term> + <term><structfield>class</structfield></term> <listitem><para> - <type>character varying(20)</type> + <type>text</type> + <literal>NOT NULL</literal> + @@ -3334,13 +4296,17 @@ </varlistentry> <varlistentry> - <term><structfield>iban</structfield></term> + <term><structfield>active</structfield></term> <listitem><para> - <type>character varying(34)</type> + <type>boolean</type> + + + <literal>NOT NULL</literal> + <literal>DEFAULT true</literal> @@ -3349,14 +4315,109 @@ </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Constraints on entity_class</title> + + <varlistentry> + <term>entity_class_class_check</term> + <listitem><para>CHECK (("class" ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing company via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.company"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.entity"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.entity-class-to-entity"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.entity-class-to-entity" + xreflabel="public.entity_class_to_entity"> + <title id="public.table.entity-class-to-entity-title"> + Table: + + <structname>entity_class_to_entity</structname> + </title> + + + <para> + Relation builder for classes to entity + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>entity_class_to_entity</structname> + </title> + + <varlistentry> - <term><structfield>bic</structfield></term> + <term><structfield>entity_class_id</structfield></term> <listitem><para> - <type>character varying(11)</type> + <type>integer</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/> + @@ -3366,7 +4427,7 @@ </varlistentry> <varlistentry> - <term><structfield>managerid</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> <type>integer</type> @@ -3375,22 +4436,91 @@ + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> </listitem> </varlistentry> + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.entity-other-name" + xreflabel="public.entity_other_name"> + <title id="public.table.entity-other-name-title"> + Table: + + <structname>entity_other_name</structname> + </title> + + + <para> + Similar to company_other_name, a person may be jd, Joshua Drake, linuxpoet... all are the same person. + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>entity_other_name</structname> + </title> + + <varlistentry> - <term><structfield>employeenumber</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> - <type>character varying(32)</type> + <type>integer</type> + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> @@ -3398,40 +4528,40 @@ </varlistentry> <varlistentry> - <term><structfield>dob</structfield></term> + <term><structfield>other_name</structfield></term> <listitem><para> - <type>date</type> + <type>text</type> + <literal>PRIMARY KEY</literal> - </para> - </listitem> - </varlistentry> - </variablelist> - <variablelist> - <title>Indexes on employee</title> - <varlistentry> - <term>employee_id_key</term> - <listitem><para>id</para></listitem> + </para> + + </listitem> </varlistentry> + </variablelist> + + + <variablelist> + <title>Constraints on entity_other_name</title> <varlistentry> - <term>employee_name_key</term> - <listitem><para>lower((name)::text)</para></listitem> + <term>entity_other_name_other_name_check</term> + <listitem><para>CHECK ((other_name ~ '[[:alnum:]_]'::text))</para></listitem> </varlistentry> </variablelist> @@ -3443,6 +4573,8 @@ + + </para> </section> @@ -3663,7 +4795,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -3676,8 +4808,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -3738,7 +4868,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -3748,6 +4878,14 @@ + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -3802,13 +4940,6 @@ <varlistentry> - <term>gl_employee_id_key</term> - <listitem><para>employee_id</para></listitem> - </varlistentry> - - - - <varlistentry> <term>gl_id_key</term> <listitem><para>id</para></listitem> </varlistentry> @@ -3953,7 +5084,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -3963,6 +5094,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -4027,7 +5168,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -4040,8 +5181,6 @@ - <literal>DEFAULT nextval('invoiceid'::regclass)</literal> - @@ -4330,7 +5469,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -4343,8 +5482,6 @@ - <literal>DEFAULT nextval('jcitemsid'::regclass)</literal> - @@ -4515,7 +5652,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -4525,6 +5662,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -4644,6 +5791,239 @@ </para> </section> + <section id="public.table.location" + xreflabel="public.location"> + <title id="public.table.location-title"> + Table: + + <structname>location</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>location</structname> + </title> + + + <varlistentry> + <term><structfield>id</structfield></term> + <listitem><para> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>line_one</structfield></term> + <listitem><para> + <type>text</type> + + + + <literal>NOT NULL</literal> + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>line_two</structfield></term> + <listitem><para> + <type>text</type> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>line_three</structfield></term> + <listitem><para> + <type>text</type> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>city_province</structfield></term> + <listitem><para> + <type>text</type> + + + + <literal>NOT NULL</literal> + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>country_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.country"/> + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>mail_code</structfield></term> + <listitem><para> + <type>text</type> + + + + <literal>NOT NULL</literal> + + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + <variablelist> + <title>Constraints on location</title> + + <varlistentry> + <term>location_city_province_check</term> + <listitem><para>CHECK ((city_province ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + + + <varlistentry> + <term>location_line_one_check</term> + <listitem><para>CHECK ((line_one ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + + + <varlistentry> + <term>location_mail_code_check</term> + <listitem><para>CHECK ((mail_code ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing company via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.company"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.company-to-location"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-company"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + <section id="public.table.makemodel" xreflabel="public.makemodel"> <title id="public.table.makemodel-title"> @@ -4778,7 +6158,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -4791,8 +6171,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -4837,7 +6215,7 @@ </varlistentry> <varlistentry> - <term><structfield>vendor_id</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> <type>integer</type> @@ -4847,20 +6225,14 @@ - </para> + <literal>NOT NULL</literal> - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>customer_id</structfield></term> - <listitem><para> - <type>integer</type> + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> </para> @@ -4981,7 +6353,7 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> + <term><structfield>person_id</structfield></term> <listitem><para> <type>integer</type> @@ -4991,6 +6363,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + </para> </listitem> @@ -5144,22 +6526,41 @@ </listitem> </varlistentry> - </variablelist> + <varlistentry> + <term><structfield>oe_class_id</structfield></term> + <listitem><para> + <type>integer</type> - <variablelist> - <title>Indexes on oe</title> - <varlistentry> - <term>oe_employee_id_key</term> - <listitem><para>employee_id</para></listitem> + + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.oe-class"/> + + + </para> + + </listitem> </varlistentry> + </variablelist> + + + + <variablelist> + <title>Indexes on oe</title> + <varlistentry> <term>oe_id_key</term> <listitem><para>id</para></listitem> @@ -5191,6 +6592,117 @@ </para> </section> + <section id="public.table.oe-class" + xreflabel="public.oe_class"> + <title id="public.table.oe-class-title"> + Table: + + <structname>oe_class</structname> + </title> + + + <para> + This could probably be done better. But I need to remove the customer_id/vendor_id relationship and instead rely on a classification + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>oe_class</structname> + </title> + + + <varlistentry> + <term><structfield>id</structfield></term> + <listitem><para> + <type>smallint</type> + + + + + <literal>UNIQUE</literal> + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>oe_class</structfield></term> + <listitem><para> + <type>text</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + <variablelist> + <title>Constraints on oe_class</title> + + <varlistentry> + <term>oe_class_id_check</term> + <listitem><para>CHECK (((id = 1) OR (id = 2)))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing oe via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.oe"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + <section id="public.table.orderitems" xreflabel="public.orderitems"> <title id="public.table.orderitems-title"> @@ -5211,7 +6723,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -5224,8 +6736,6 @@ - <literal>DEFAULT nextval('orderitemsid'::regclass)</literal> - @@ -5480,7 +6990,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -5493,8 +7003,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -6191,7 +7699,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -6204,8 +7712,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -6408,7 +7914,7 @@ <varlistentry> - <term><structfield>vendor_id</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> <type>integer</type> @@ -6418,6 +7924,16 @@ + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + </para> </listitem> @@ -6542,11 +8058,207 @@ <listitem><para>parts_id</para></listitem> </varlistentry> + </variablelist> + + + + + + + + + </para> + </section> + + <section id="public.table.person" + xreflabel="public.person"> + <title id="public.table.person-title"> + Table: + + <structname>person</structname> + </title> + + + <para> + Every person, must have an entity to derive a common or display name. The correct way to get class information on a person would be person.entity_id->entity_class_to_entity.entity_id. + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>person</structname> + </title> + + + <varlistentry> + <term><structfield>id</structfield></term> + <listitem><para> + <type>serial</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>entity_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + <literal>NOT NULL</literal> + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>salutation_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.salutation"/> + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>first_name</structfield></term> + <listitem><para> + <type>text</type> + + + + <literal>NOT NULL</literal> + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>middle_name</structfield></term> + <listitem><para> + <type>text</type> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>last_name</structfield></term> + <listitem><para> + <type>text</type> + + + <literal>NOT NULL</literal> + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>primary_location_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.location"/> + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + <variablelist> + <title>Constraints on person</title> <varlistentry> - <term>partsvendor_vendor_id_key</term> - <listitem><para>vendor_id</para></listitem> + <term>person_first_name_check</term> + <listitem><para>CHECK ((first_name ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + + + <varlistentry> + <term>person_last_name_check</term> + <listitem><para>CHECK ((last_name ~ '[[:alnum:]_]'::text))</para></listitem> </varlistentry> </variablelist> @@ -6557,6 +8269,475 @@ + <itemizedlist> + <title> + Tables referencing ap via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.ap"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.ar"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.audittrail"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.gl"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.inventory"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.jcitems"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.oe"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-company"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-contact"/> + </para> + </listitem> + + + + <listitem> + <para> + <xref linkend="public.table.person-to-entity"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + + <section id="public.table.person-to-company" + xreflabel="public.person_to_company"> + <title id="public.table.person-to-company-title"> + Table: + + <structname>person_to_company</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>person_to_company</structname> + </title> + + + <varlistentry> + <term><structfield>location_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.location"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>person_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.person-to-contact" + xreflabel="public.person_to_contact"> + <title id="public.table.person-to-contact-title"> + Table: + + <structname>person_to_contact</structname> + </title> + + + <para> + To keep track of the relationship between multiple contact methods and a single individual + </para> + + + <para> + <variablelist> + <title> + Structure of <structname>person_to_contact</structname> + </title> + + + <varlistentry> + <term><structfield>person_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>contact_class_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>contact</structfield></term> + <listitem><para> + <type>text</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + <variablelist> + <title>Constraints on person_to_contact</title> + + <varlistentry> + <term>person_to_contact_contact_check</term> + <listitem><para>CHECK ((contact ~ '[[:alnum:]_]'::text))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + + + + </para> + </section> + + <section id="public.table.person-to-entity" + xreflabel="public.person_to_entity"> + <title id="public.table.person-to-entity-title"> + Table: + + <structname>person_to_entity</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>person_to_entity</structname> + </title> + + + <varlistentry> + <term><structfield>person_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.person"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>entity_id</structfield></term> + <listitem><para> + <type>integer</type> + + + + + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>related_how</structfield></term> + <listitem><para> + <type>text</type> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>created</structfield></term> + <listitem><para> + <type>date</type> + + + + <literal>NOT NULL</literal> + + + + <literal>DEFAULT ('now'::text)::date</literal> + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + <variablelist> + <title>Constraints on person_to_entity</title> + + <varlistentry> + <term>person_to_entity_check</term> + <listitem><para>CHECK ((entity_id <> person_id))</para></listitem> + </varlistentry> + + </variablelist> + + + + + + + + + </para> </section> @@ -6581,7 +8762,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -6594,8 +8775,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -6674,7 +8853,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -6687,8 +8866,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - @@ -7246,6 +9423,103 @@ </para> </section> + <section id="public.table.salutation" + xreflabel="public.salutation"> + <title id="public.table.salutation-title"> + Table: + + <structname>salutation</structname> + </title> + + + + <para> + <variablelist> + <title> + Structure of <structname>salutation</structname> + </title> + + + <varlistentry> + <term><structfield>id</structfield></term> + <listitem><para> + <type>serial</type> + + + + + <literal>UNIQUE</literal> + + + + + <literal>NOT NULL</literal> + + + + + + + + </para> + + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>salutation</structfield></term> + <listitem><para> + <type>text</type> + + + <literal>PRIMARY KEY</literal> + + + + + + + + + + + + + + </para> + + </listitem> + </varlistentry> + + </variablelist> + + + + + + + + <itemizedlist> + <title> + Tables referencing person via Foreign Key Constraints + </title> + + <listitem> + <para> + <xref linkend="public.table.person"/> + </para> + </listitem> + + </itemizedlist> + + + + + + + </para> + </section> + <section id="public.table.shipto" xreflabel="public.shipto"> <title id="public.table.shipto-title"> @@ -8290,6 +10564,10 @@ </title> + <para> + Now a meta data table + </para> + <para> <variablelist> @@ -8301,7 +10579,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -8314,104 +10592,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>name</structfield></term> - <listitem><para> - <type>character varying(64)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>address1</structfield></term> - <listitem><para> - <type>character varying(32)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>address2</structfield></term> - <listitem><para> - <type>character varying(32)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>city</structfield></term> - <listitem><para> - <type>character varying(32)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>state</structfield></term> - <listitem><para> - <type>character varying(32)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>zipcode</structfield></term> - <listitem><para> - <type>character varying(10)</type> - - - @@ -8422,57 +10602,9 @@ </varlistentry> <varlistentry> - <term><structfield>country</structfield></term> + <term><structfield>entity_id</structfield></term> <listitem><para> - <type>character varying(32)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>contact</structfield></term> - <listitem><para> - <type>character varying(64)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>phone</structfield></term> - <listitem><para> - <type>character varying(20)</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>fax</structfield></term> - <listitem><para> - <type>character varying(20)</type> + <type>integer</type> @@ -8480,36 +10612,14 @@ - </para> - - </listitem> - </varlistentry> + <literal>NOT NULL</literal> - <varlistentry> - <term><structfield>email</structfield></term> - <listitem><para> - <type>text</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> - <term><structfield>notes</structfield></term> - <listitem><para> - <type>text</type> + <literal>REFERENCES</literal> <xref linkend="public.table.entity"/> </para> @@ -8728,22 +10838,6 @@ </varlistentry> <varlistentry> - <term><structfield>employee_id</structfield></term> - <listitem><para> - <type>integer</type> - - - - - - - - </para> - - </listitem> - </varlistentry> - - <varlistentry> <term><structfield>language_code</structfield></term> <listitem><para> <type>character varying(6)</type> @@ -8833,13 +10927,6 @@ <title>Indexes on vendor</title> <varlistentry> - <term>vendor_contact_key</term> - <listitem><para>lower((contact)::text)</para></listitem> - </varlistentry> - - - - <varlistentry> <term>vendor_id_key</term> <listitem><para>id</para></listitem> </varlistentry> @@ -8847,13 +10934,6 @@ <varlistentry> - <term>vendor_name_key</term> - <listitem><para>lower((name)::text)</para></listitem> - </varlistentry> - - - - <varlistentry> <term>vendor_vendornumber_key</term> <listitem><para>vendornumber</para></listitem> </varlistentry> @@ -8943,18 +11023,6 @@ - <variablelist> - <title>Indexes on vendortax</title> - - <varlistentry> - <term>vendortax_vendor_id_key</term> - <listitem><para>vendor_id</para></listitem> - </varlistentry> - - </variablelist> - - - @@ -8983,7 +11051,7 @@ <varlistentry> <term><structfield>id</structfield></term> <listitem><para> - <type>integer</type> + <type>serial</type> <literal>PRIMARY KEY</literal> @@ -8996,8 +11064,6 @@ - <literal>DEFAULT nextval('id'::regclass)</literal> - |