Difference between revisions of "VbzCart/tables"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(→‎Catalog: topic tables renamed)
(→‎Event Logging: more obsolete tables, so I can close the tabs)
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Navigation==
+
==Current Tables==
<section begin=navbar />{{#lst:VbzCart|navbar}}: [[VbzCart/tables|tables]]<section end=navbar />
 
 
 
==Main Data==
 
 
===Catalog===
 
===Catalog===
 
These tables describe and price the items displayed in the catalog pages and in shopping carts.
 
These tables describe and price the items displayed in the catalog pages and in shopping carts.
Line 16: Line 13:
 
* [[/cat_ittyps]]: item types - every item has one, but they are often all the same
 
* [[/cat_ittyps]]: item types - every item has one, but they are often all the same
 
* [[/cat_ioptns]]: these typically distinguish items within a title
 
* [[/cat_ioptns]]: these typically distinguish items within a title
* [[/cat_folders]]: where things are stored and how to access them (sort of a mini-[[FileFerret]])
 
 
* [[/cat_topic]]: categorization
 
* [[/cat_topic]]: categorization
 
** [[/cat_title_x_topic]]: titles for each topic
 
** [[/cat_title_x_topic]]: titles for each topic
* [[/cat_images]]: image data; so far, we only keep track of images by title
 
 
* [[/cat_ship_cost]]: shipping costs for different types of item
 
* [[/cat_ship_cost]]: shipping costs for different types of item
 
* [[/cat_pages]]: mapping URLs to various catalog entities (suppliers, depts, titles)
 
* [[/cat_pages]]: mapping URLs to various catalog entities (suppliers, depts, titles)
Line 27: Line 22:
  
 
===Catalog Entry===
 
===Catalog Entry===
These are tables used to make it easier to update the catalog. The key concept here is "catalog title groups" (CTGs). A CTG is a set of titles which are all available with the same set of options (e.g. sizes) at the same prices (e.g. $10 S, $11 M-XL, $12 2XL). The final vbz catalog (cat_items) is the result of a sort of vector multiplication of Titles (cat_titles) and CTGs plus any items in stock.
+
These are tables used to make it easier to update the {{l/vc/piece|catalog/local|local catalog}}; see {{l/vc/piece|catalog/supplier}} and {{l/vc/piece|catalog/building}}.
  
A "source" is usually a printed catalog from a supplier, though it can also be the manufacturer's web site on a particular date.
+
* <s>[[/ctg_supp]]</s> - deprecated
 
 
See [[VbzCart catalog building]] for queries and processes.
 
* [[/ctg_supp]]
 
 
* [[/ctg_prc_funcs]]
 
* [[/ctg_prc_funcs]]
 
* [[/ctg_sources]]
 
* [[/ctg_sources]]
Line 40: Line 32:
 
* [[/ctg_upd1]]
 
* [[/ctg_upd1]]
 
* [[/ctg_upd2]]
 
* [[/ctg_upd2]]
 
+
===File Management===
 +
* [[/fm_node]]: a filesystem entity (could be either file or folder)
 +
* [[/fm_file]]: files of any type
 +
* [[/fm_folder]]: places where files can be stored
 +
* [[/cat_images]]: files that are images, with additional metadata
 
===Ordering===
 
===Ordering===
The items a customer wants to order are saved in a cart. The cart also saves session information, e.g. customer's IP/domain, but not the customer's shipping or payment data. Later on, we'll allow customers to make changes to carts after the cart has already been assigned to an order, so will need session info stored separately, which is why it's in a separate table. See [[VbzCart ordering]] for details.
+
Cart data and line-items are converted to orders and order lines when the customer confirms the order. Orders become the focal point for a lot of other activity, such as shipping, transactions, and tracking of status changes.
 
 
There is a handful of tables just for managing customer contact information, so  I'm putting those on a separate page: [[VbzCart customer tables]]
 
  
* [[/core_orders]]
+
* [[/orders]]
* [[/ord_lines]]
+
** [[/ord_lines]]
* [[/ord_pkgs]]
+
** [[/ord_pkgs]]
* [[/ord_pkg_lines]]
+
** [[/ord_pkg_lines]]
* [[/ord_shipmt]]
+
** [[/ord_shipmt]]
* [[/ord_trxact]] - order transactions
+
** [[/ord_trxact]] - order transactions
* [[/ord_trx_type]] - order transaction types
+
** [[/ord_trx_type]] - order transaction types
* [[/ord_event]] - internal events not generally affecting order status
+
** [[/ord_msg]]
* [[/ord_pull]]
+
*** [[/ord_msg_media]]
** [[/ord_pull_type]] - can this be migrated to ord_event_type?
+
** ''see also [[#Event Logging]]''
** [[/ord_change]] - admin-initiated events which change order status; will eventually replace and supplement ord_pull
+
* [[/card_auth_code]] - reference table for payment status codes; this should probably be a hard-coded array, not a table
*** [[/ord_change_type]]
+
* '''obsolete''':
* [[/ord_msg]]
+
** [[/ord_pull]]
** [[/ord_msg_media]]
+
*** [[/ord_pull_type]]  
* [[/card_auth_code]] - should probably be in a different section
+
** [[/ord_event]] - internal events not generally affecting order status
  
 
===Customers===
 
===Customers===
 
There ought to be a better way to organize this stuff, but I haven't been able to think of one that doesn't cause worse problems. Each type of customer data has its own set of fields and its own search-optimization, and combining them results in the awkward possibility of pulling up the wrong type of data under certain circumstances. So, until something better comes along...
 
There ought to be a better way to organize this stuff, but I haven't been able to think of one that doesn't cause worse problems. Each type of customer data has its own set of fields and its own search-optimization, and combining them results in the awkward possibility of pulling up the wrong type of data under certain circumstances. So, until something better comes along...
  
* [[/core_custs]] - main customer records
+
* [[/cust]] - main customer records
* [[/cust_addrs]] - customer mailing addresses (shipping and credit card)
+
* [[/cust_addr]] - customer mailing addresses (shipping and credit card)
 
* [[/cust_cards]] - customer credit card numbers - '''sensitive data'''
 
* [[/cust_cards]] - customer credit card numbers - '''sensitive data'''
 
* [[/cust_emails]] - customer email addresses
 
* [[/cust_emails]] - customer email addresses
* [[/cust_names]] - customer names/aliases
+
* <s>[[/cust_names]] - customer names/aliases</s> - deprecated
 
* [[/cust_phones]] - customer phone numbers
 
* [[/cust_phones]] - customer phone numbers
 
* [[/cust_charges]] - credit card charges - '''sensitive data''' (includes card #s)
 
* [[/cust_charges]] - credit card charges - '''sensitive data''' (includes card #s)
 +
 +
===Users===
 +
Customers can be users, but only when they've created a user account. Users can also be admins and (eventually) suppliers and vendors.
 +
* [[/user]]
 +
** [[/user_tokens]] - for emailing password-reset links
 +
** [[/user_client]]
 +
** [[/user_session]]
 +
** '''access control''':
 +
*** [[/ugroup]] - groups to which users may belong
 +
*** [[/uperm]] - permissions a group may have
 +
*** [[/user_x_ugroup]] - groups to which each user belongs
 +
*** [[/ugroup_x_uperm]] - permissions each group has
  
 
===Restocking===
 
===Restocking===
Line 80: Line 86:
 
* [[/rstk_rcd_line]] - items received in a restock shipment
 
* [[/rstk_rcd_line]] - items received in a restock shipment
 
* [[/rstk_req_item_minima]] - items types with minimum supplier orders
 
* [[/rstk_req_item_minima]] - items types with minimum supplier orders
====obsolete tables====
 
* [[/core_restocks]] - OBSOLETE
 
* [[/rstk_lines]] - OBSOLETE
 
 
===Shopping===
 
===Shopping===
 
These tables store data generated by the user during the shopping process.
 
These tables store data generated by the user during the shopping process.
Line 88: Line 91:
 
** [[/shop_cart_line]]
 
** [[/shop_cart_line]]
 
** [[/shop_cart_event]]
 
** [[/shop_cart_event]]
** [[/shop_cart_data]]
+
** [[/cart_data]]
** <s>[[/shop_cart_data_type]]</s> - not used
+
** [[/shop_cart_data]] - OBSOLETE
* [[/shop_log]]
+
 
* [[/shop_client]]
 
* [[/shop_session]]: A new session should be created whenever the "same" client doesn't remember the session cookie (could be a different computer on the same IP address), or if the session has timed out.
 
 
===Stock Management===
 
===Stock Management===
* [[/stk_items]]
+
* [[/stk_lines]]
 
* [[/stk_bins]]
 
* [[/stk_bins]]
 +
** [[/stk_bin_history]]
 
* [[/stk_places]]
 
* [[/stk_places]]
 
* [[/stk_history]]
 
* [[/stk_history]]
* [[/stk_history_legacy]] - for accommodating old nonconforming data
+
* [[/stk_whse]]: warehouses
* [[/stk_bin_history]]
+
 
 
===Caching===
 
===Caching===
 
====Management====
 
====Management====
 
See [[User:Woozle/datamgr.php]] for the code that handles this.
 
See [[User:Woozle/datamgr.php]] for the code that handles this.
 
* [[/cache_tables]] - list of tables involved in data caching, either as a source or as a cache
 
* [[/cache_tables]] - list of tables involved in data caching, either as a source or as a cache
* [[/cache_queries]] - list of [[../queries|queires]] which update one table from others
+
* [[/cache_queries]] - list of [[../procs|stored procedures]] which update one table from others
 
* [[/cache_flow]] - which queries update which caches from which sources  
 
* [[/cache_flow]] - which queries update which caches from which sources  
 
* [[/cache_log]] - log of all cache updates done within cache management
 
* [[/cache_log]] - log of all cache updates done within cache management
Line 114: Line 116:
 
** &larr; _dept_ittyps by ID_Dept &ndash; {{vbzcart|proc|Upd_Depts_fr_DeptIttyps}}
 
** &larr; _dept_ittyps by ID_Dept &ndash; {{vbzcart|proc|Upd_Depts_fr_DeptIttyps}}
 
* [[/_titles]]
 
* [[/_titles]]
** &larr; titles x _depts &ndash; {{vbzcart|proc|Upd_Titles_fr_Depts}}
 
** &larr; cat_items (grouped by ID_Title) &ndash; {{vbzcart|proc|Upd_Titles_fr_CatItems}}
 
** &larr; _title_ittyps (grouped by ID_Title) &ndash; {{vbzcart|proc|Upd_Titles_fr_TitleIttyps}}
 
 
* [[/_title_ittyps]] - list of available titles for each item type
 
* [[/_title_ittyps]] - list of available titles for each item type
 
** &larr; cat_items (grouped by ID_Title), cat_titles &ndash; {{vbzcart|proc|Upd_TitleIttyps_fr_CatItems_Titles}}
 
** &larr; cat_items (grouped by ID_Title), cat_titles &ndash; {{vbzcart|proc|Upd_TitleIttyps_fr_CatItems_Titles}}
Line 128: Line 127:
 
* [[/_stk_containers]]
 
* [[/_stk_containers]]
 
** &larr; stk_bins, cat_items... &ndash; {{vbzcart|proc|Upd_StkContainers}}
 
** &larr; stk_bins, cat_items... &ndash; {{vbzcart|proc|Upd_StkContainers}}
==Miscellaneous==
+
 
 +
===Event Logging===
 +
* {{l/ferreteria}} tables:
 +
** {{l/ferreteria/table|event}}: EventPlex core
 +
** {{l/ferreteria/table|event_done}}
 +
** {{l/ferreteria/table|event_in_table}}
 +
** {{l/ferreteria/table|event_notes}}
 +
* Custom EventPlex extensions
 +
** [[/event_vc_legacy]] - old log data
 +
** [[/event_vc_bin]] - stock bin log
 +
** [[/event_vc_ord_hold]] - order status log
 +
*** [[/ord_hold_type]]
 +
** to be converted:
 +
*** [[/stk_history]]
 +
* obsolete:
 +
** [[/event_log]] - now renamed <code>OLD event_log</code>, soon to be removed
 +
** [[/shop_cart_event]] - now renamed <code>OLD shop_cart_event</code>, to be removed after checking that data has been migrated
 +
** [[/ord_pull]]
 +
*** [[/ord_pull/migration]]
 +
** [[/shop_cart_event]]
 +
 
 +
===Miscellaneous===
 +
* [[/ref_country]] - list of countries
 +
** [[/ref_country_alias]] - list of possible country name spellings
 
* [[/var_global]]
 
* [[/var_global]]
* [[/event_log]]
+
* {{l/vc|archive/tables}} - discarded tables
* [[/discarded]] - discarded tables
+
 
 
==Revisions Under Consideration==
 
==Revisions Under Consideration==
 
===2011-09-26===
 
===2011-09-26===

Latest revision as of 13:47, 3 March 2020

Current Tables

Catalog

These tables describe and price the items displayed in the catalog pages and in shopping carts.

A "Title" is a group of items with a common description, e.g. different sizes or styles of a shirt, different media (CD, cassette) for an audio recording.

In the previous version of the cart software, we had to have items of somewhat different appearance (e.g. longsleeve and shortsleeve shirts) sharing a single title, so as to remove the necessity to always have pictures for each. In this version, a title can point to another title for its picture, thus keeping it clear whether the picture is truly representative or just an approximation.

  • /cat_supp: catalog suppliers (i.e. manufacturers, wholesalers)
  • /cat_depts: catalog departments within a supplier
  • /cat_titles: titles within a department - a particular "thing" which may be available in multiple varieties
  • /cat_items: items within a title - a particular version of a title
  • /cat_ittyps: item types - every item has one, but they are often all the same
  • /cat_ioptns: these typically distinguish items within a title
  • /cat_topic: categorization
  • /cat_ship_cost: shipping costs for different types of item
  • /cat_pages: mapping URLs to various catalog entities (suppliers, depts, titles)
  • /cat_pages_old: catalog designations sometimes change; where possible, this lets us redirect old URLs

future

It may be that Departments and Suppliers should be handled by the Topics tree, but this involves creating some infrastructure which is going to take some doing. (Specifically, we need to be able to assign named values – like "catkey" – to any topic, so that each Department topic and Supplier topic can refer to the proper catalog number.)

Catalog Entry

These are tables used to make it easier to update the local catalog; see catalog/supplier and catalog/building.

File Management

  • /fm_node: a filesystem entity (could be either file or folder)
  • /fm_file: files of any type
  • /fm_folder: places where files can be stored
  • /cat_images: files that are images, with additional metadata

Ordering

Cart data and line-items are converted to orders and order lines when the customer confirms the order. Orders become the focal point for a lot of other activity, such as shipping, transactions, and tracking of status changes.

Customers

There ought to be a better way to organize this stuff, but I haven't been able to think of one that doesn't cause worse problems. Each type of customer data has its own set of fields and its own search-optimization, and combining them results in the awkward possibility of pulling up the wrong type of data under certain circumstances. So, until something better comes along...

Users

Customers can be users, but only when they've created a user account. Users can also be admins and (eventually) suppliers and vendors.

Restocking

Shopping

These tables store data generated by the user during the shopping process.

Stock Management

Caching

Management

See User:Woozle/datamgr.php for the code that handles this.

Calculated Tables

These are used for caching data which takes a long time (more than 0.3 seconds or so) to calculate and which depends on things which change a lot less often than pages are viewed.

Event Logging

Miscellaneous

Revisions Under Consideration

2011-09-26

The /cat_depts table is seeming increasingly useless and an obstacle to good data design. Suppliers are prone to assigning items to different departments every year as their offerings change, and few or none of them use departments as part of their catalog key. In cases where they do, the amount of time saved by not having to key in 2-4 extra characters per catalog number simply isn't worth the extra maintenance and coding to make this work reliably.

The function of the cat_depts table can be replaced by the /brs_topics table (which should be renamed cat_topics).

Once you start thinking about life after cat_depts, however, one has to ask whether /cat_supp should also be rolled into brs_topics. Obviously suppliers do, unlike departments, have some data significance: suppliers have catalogs, catalog groups, price functions, restock history... most of which data goes in other tables, not cat_supp itself, so it wouldn't be hard to use topics for suppliers too.

That would make it easier to allow the same item to be purchasable from multiple suppliers -- but how do you handle catalog numbers then? The same item can have different catalog numbers depending on where it was ordered from? Possibly this makes sense, but it still would cause trouble: each item still only has one item record, and that record needs a catalog number. Do you then move catalog numbers into a separate table that records item-to-supplier relationships?

Is there any stopping point, short of "going all the way", that seems sensible? Can't we just eliminate departments for now, and worry about further enhancements later after mopping up all the code changes that that alone will require? That's probably a sensible compromise.