Difference between revisions of "VbzCart/tables/ord pull"

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
(preliminary migration design)
Line 12: Line 12:
 
** '''2009-10-27''' Added user/machine fields; Notes -> NotesPull, added NotesFree
 
** '''2009-10-27''' Added user/machine fields; Notes -> NotesPull, added NotesFree
 
*** This should ease the transition to using the {{vbzcart|table|ord_change}} table
 
*** This should ease the transition to using the {{vbzcart|table|ord_change}} table
 +
** '''2017-06-02''' Migrating to {{l/vbzcart/table|event_vc_ord_hold}}; documenting migration process.
 
==Migration==
 
==Migration==
Notes:
+
This is complicated by the fact that we will have '''two''' hold-event records for pulls which have been released.
 +
 
 +
There are 1665 Order Pull events to migrate, with 528 of those being released (freed), for a total of 2193 EventPlex records to create. We have a gap in the event table from IDs 1230 to 6354, so let's start the pulls at ID 1501 for "invoke" and (1500+1700=) 3201 for "release".
 +
 
 +
I'm not going to worry about events being IDed out of chronological order, at least for now. If it becomes important later, maybe we'll have an event-renumbering tool. (The only non-event table that references events by ID, so far, is orders.ID_Hold. Maybe it should be changed to a timestamp. There should probably be a rule against referencing event records from other records. If we ever need to, then maybe a "bookmarks" EventPlex extension is called for. What happens in the events log stays in the events log...)
 +
 
 +
Where:
 +
* "event" = {{l/ferreteria/table|event}}
 +
* "legacy" = {{l/vbzcart/table|event_vc_legacy}}
 +
* "notes" = {{l/ferreteria/table|event_notes}}
 +
* "hold" = {{l/vbzcart/table|event_vc_ord_hold}}
 +
 
 +
...migration requires the following steps:
 +
 
 +
==step 1: all holds==
 +
* ID: renumber for invoke, then for each pull record:
 +
** -> event.ID
 +
** -> hold.ID_Event
 +
* FALSE -> hold.isRelease
 +
* ID_Ord -> hold.ID_Order
 +
* ID_Type -> hold.ID_Type
 +
* WhenPulled -> event.WhenStart
 +
* NotesPull -> notes.Notes
 
* VbzUser -> legacy.WhoAdmin
 
* VbzUser -> legacy.WhoAdmin
 
* SysUser -> legacy.WhoSystem
 
* SysUser -> legacy.WhoSystem
 
* Machine -> legacy.WhoNetwork
 
* Machine -> legacy.WhoNetwork
  
There are 1665 Order Pull events to migrate, and we have a gap in the event table from IDs 1230 to 6354, so let's start the pulls at ID 1500.
+
==step 2: released holds only==
 +
* ID: renumber (again) released pulls only, then for each pull record:
 +
** -> event.ID
 +
** -> hold.ID_Event
 +
* TRUE -> hold.isRelease
 +
* ID_Ord -> hold.ID_Order
 +
* ID_Type -> hold.ID_Type
 +
* WhenFreed -> event.WhenStart
 +
* NotesFree -> notes.Notes
 +
* (Note: no separate record of who released each pull, so leave applicable fields blank)
 +
 
 
==SQL==
 
==SQL==
 
<mysql>CREATE TABLE `ord_pull` (
 
<mysql>CREATE TABLE `ord_pull` (

Revision as of 11:48, 2 June 2017

This documentation is obsolete, and is being kept solely for archival purposes.
This table (ord_pull) is being replaced by event_vc_ord_change.

About

  • Purpose: Log of order pulls/releases
  • Notes: this will eventually be replaced by ord_change
  • Relates to: core_orders, ord_pull_type
  • Fields:
    • WhenFreed (was WhenReleased): when the pull was cancelled/revoked; if it is set, this pull is inactive
    • Notes* may include quite lengthy explanations of what happened (similar to ord_msg)
  • History:
    • 2009-07-09 Adapted from MS Access
    • 2009-07-10 Expanded "Notes" from VARCHAR(255) to MEDIUMTEXT
    • 2009-10-27 Added user/machine fields; Notes -> NotesPull, added NotesFree
      • This should ease the transition to using the ord_change table
    • 2017-06-02 Migrating to event_vc_ord_hold; documenting migration process.

Migration

This is complicated by the fact that we will have two hold-event records for pulls which have been released.

There are 1665 Order Pull events to migrate, with 528 of those being released (freed), for a total of 2193 EventPlex records to create. We have a gap in the event table from IDs 1230 to 6354, so let's start the pulls at ID 1501 for "invoke" and (1500+1700=) 3201 for "release".

I'm not going to worry about events being IDed out of chronological order, at least for now. If it becomes important later, maybe we'll have an event-renumbering tool. (The only non-event table that references events by ID, so far, is orders.ID_Hold. Maybe it should be changed to a timestamp. There should probably be a rule against referencing event records from other records. If we ever need to, then maybe a "bookmarks" EventPlex extension is called for. What happens in the events log stays in the events log...)

Where:

...migration requires the following steps:

step 1: all holds

  • ID: renumber for invoke, then for each pull record:
    • -> event.ID
    • -> hold.ID_Event
  • FALSE -> hold.isRelease
  • ID_Ord -> hold.ID_Order
  • ID_Type -> hold.ID_Type
  • WhenPulled -> event.WhenStart
  • NotesPull -> notes.Notes
  • VbzUser -> legacy.WhoAdmin
  • SysUser -> legacy.WhoSystem
  • Machine -> legacy.WhoNetwork

step 2: released holds only

  • ID: renumber (again) released pulls only, then for each pull record:
    • -> event.ID
    • -> hold.ID_Event
  • TRUE -> hold.isRelease
  • ID_Ord -> hold.ID_Order
  • ID_Type -> hold.ID_Type
  • WhenFreed -> event.WhenStart
  • NotesFree -> notes.Notes
  • (Note: no separate record of who released each pull, so leave applicable fields blank)

SQL

<mysql>CREATE TABLE `ord_pull` (

 `ID`         INT            NOT NULL AUTO_INCREMENT,
 `ID_Ord`     INT            NOT NULL COMMENT "core_orders.ID",
 `ID_Type`    INT            NOT NULL COMMENT "ord_pull_type.ID",
 `WhenPulled` DATETIME       NOT NULL COMMENT "when this pull occurred",
 `WhenFreed`  DATETIME   DEFAULT NULL COMMENT "when this pull was dropped",

/* fields relating to who pulled the order */

 `VbzUser`    VARCHAR(127)            COMMENT "VbzCart username, if available",
 `SysUser`    VARCHAR(127)            COMMENT "operating system username, if available",
 `Machine`    VARCHAR(63)    NOT NULL COMMENT "network name or IP address of client",
 `NotesPull`  MEDIUMTEXT DEFAULT NULL COMMENT "human-added notes about the pull",
 `NotesFree`  MEDIUMTEXT DEFAULT NULL COMMENT "human-added notes about the release",
 PRIMARY KEY(`ID`)

) ENGINE = MYISAM;</mysql>