Difference between revisions of "VbzCart/tables/cust"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (ID_User) |  ("Title" field) | ||
| Line 9: | Line 9: | ||
| ** '''2009-07-09''' moved to separate wiki page; no design changes | ** '''2009-07-09''' moved to separate wiki page; no design changes | ||
| ** '''2011-11-29''' added '''WhenUpdated''' field | ** '''2011-11-29''' added '''WhenUpdated''' field | ||
| − | ** '''2013-10-10''' added '''ID_User'''  | + | ** '''2013-10-10''' added '''ID_User''' and '''Title''' fields (see {{vbzcart|table|core_users}} for rules) | 
| ==SQL== | ==SQL== | ||
| <mysql>CREATE TABLE `core_custs` ( | <mysql>CREATE TABLE `core_custs` ( | ||
| Line 16: | Line 16: | ||
|    `ID_Addr`     INT      DEFAULT NULL   COMMENT "cust_addrs.ID of default address", |    `ID_Addr`     INT      DEFAULT NULL   COMMENT "cust_addrs.ID of default address", | ||
|    `ID_User`     INT      DEFAULT NULL   COMMENT "core_users.ID of user for this customer", |    `ID_User`     INT      DEFAULT NULL   COMMENT "core_users.ID of user for this customer", | ||
| − |    `Notes`  | + |   `Title`   VARCHAR(127) DEFAULT NULL   COMMENT "user-entered title for this customer profile", | 
| + |    `Notes`   VARCHAR(255) DEFAULT NULL   COMMENT "admin-entered notes about this customer", | ||
|    `ID_Repl`     INT      DEFAULT NULL   COMMENT "core_custs.ID of replacement", |    `ID_Repl`     INT      DEFAULT NULL   COMMENT "core_custs.ID of replacement", | ||
|    `WhenCreated` DATETIME   /*NOT NULL*/ COMMENT "when this record was created", |    `WhenCreated` DATETIME   /*NOT NULL*/ COMMENT "when this record was created", | ||
Revision as of 16:55, 10 October 2013
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
- WhenChanged: not sure if this field has a purpose; it could be set whenever Notes or ID_Repl are edited, maybe?
- WhenUpdated: When this customer was updated (any time new order comes in, even if no contact info changes)
 
- History:
- 2009-07-09 moved to separate wiki page; no design changes
- 2011-11-29 added WhenUpdated field
- 2013-10-10 added ID_User and Title fields (see core_users for rules)
 
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", `ID_User` INT DEFAULT NULL COMMENT "core_users.ID of user for this customer", `Title` VARCHAR(127) DEFAULT NULL COMMENT "user-entered title for this customer profile", `Notes` VARCHAR(255) DEFAULT NULL 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", `WhenUpdated` DATETIME DEFAULT NULL COMMENT "when this contact was last updated", PRIMARY KEY(`ID`)
) ENGINE = MYISAM;</mysql>