VbzCart/docs/tables/cust: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | tables
Jump to navigation Jump to search
imported>Woozle
(New page: ==About== * '''History''': ** '''2009-07-09''' moved to separate wiki page; no design changes ==SQL== <section begin=sql /><mysql>CREATE TABLE `cust_names` ( `ID` INT NOT NULL AU...)
 
imported>Woozle
(the actual correct SQL, with documentation)
Line 1: Line 1:
==About==
==About==
* '''Purpose''': Core customer table &ndash; all the other customer data tables point to this one
* '''Fields''':
** '''ID_Repl''': If non-null, then this customer ID has been consolidated with the customer whose ID is in ID_Repl; whenever/wherever possible, replace occurrences of this ID with the value of the corresponding ID_Repl.
** '''WhenCreated''': This should be NOT NULL on systems with no legacy data
* '''History''':
* '''History''':
** '''2009-07-09''' moved to separate wiki page; no design changes
** '''2009-07-09''' moved to separate wiki page; no design changes
==SQL==
==SQL==
<section begin=sql /><mysql>CREATE TABLE `cust_names` (
<section begin=sql /><mysql>CREATE TABLE `core_custs` (
   `ID`         INT NOT NULL AUTO_INCREMENT,
   `ID`         INT         NOT NULL AUTO_INCREMENT,
   `ID_Cust`   INT COMMENT "core_custs.ID",
   `ID_Name`    INT          NOT NULL  COMMENT "cust_names.ID of default name",
   `Name`      VARCHAR(127) COMMENT "customer's name, for shipping label",
  `ID_Addr`     INT     DEFAULT NULL  COMMENT "cust_addrs.ID of default address",
   `NameSrchVARCHAR(127) COMMENT "name with delimiters removed, for matching",
   `Notes`      VARCHAR(255)           COMMENT "admin-entered notes about this customer",
   `isActiveBOOL DEFAULT FALSE COMMENT "NO=wrong spelling or name; use for searching",
  `ID_Repl`    INT      DEFAULT NULL  COMMENT "core_custs.ID of replacement",
   `WhenCreated` DATETIME   /*NOT NULL*/ COMMENT "when this record was created",
   `WhenChanged` DATETIME DEFAULT NULL   COMMENT "when this record was last edited",
   PRIMARY KEY(`ID`)
   PRIMARY KEY(`ID`)
)
)
ENGINE = MYISAM;</mysql>
ENGINE = MYISAM;</mysql>
<section end=sql />
<section end=sql />

Revision as of 19:35, 9 July 2009

About

  • Purpose: Core customer table – all the other customer data tables point to this one
  • Fields:
    • ID_Repl: If non-null, then this customer ID has been consolidated with the customer whose ID is in ID_Repl; whenever/wherever possible, replace occurrences of this ID with the value of the corresponding ID_Repl.
    • WhenCreated: This should be NOT NULL on systems with no legacy data
  • History:
    • 2009-07-09 moved to separate wiki page; no design changes

SQL

<section begin=sql /><mysql>CREATE TABLE `core_custs` (

 `ID`          INT          NOT NULL AUTO_INCREMENT,
 `ID_Name`     INT          NOT NULL   COMMENT "cust_names.ID of default name",
 `ID_Addr`     INT      DEFAULT NULL   COMMENT "cust_addrs.ID of default address",
 `Notes`       VARCHAR(255)            COMMENT "admin-entered notes about this customer",
 `ID_Repl`     INT      DEFAULT NULL   COMMENT "core_custs.ID of replacement",
 `WhenCreated` DATETIME   /*NOT NULL*/ COMMENT "when this record was created",
 `WhenChanged` DATETIME DEFAULT NULL   COMMENT "when this record was last edited",
 PRIMARY KEY(`ID`)

) ENGINE = MYISAM;</mysql> <section end=sql />