Script to correct faulty statistics table entries.
authorJoe Atzberger <joe.atzberger@liblime.com>
Wed, 25 Jun 2008 23:21:28 +0000 (18:21 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 26 Jun 2008 10:51:26 +0000 (05:51 -0500)
commit1de9cb26a2c65d2c339dc715a40168463b403635
treeadc32d3bd74e178999ec5db6cbbfe5c89bf316ad
parenta6246ca669013b54d38223b444bf276503be042b
Script to correct faulty statistics table entries.

This is the first iteration of this script, likely to be expanded
if other mappings are determined.  Currently it populates the
itemtype for all statistics that have itemnumbers and then pulls
borrownumbers from old_issues (or issues).  This has the benign
side effect of ignoring whether or not itemtype was a different
value at the time of the transaction.

It then tries to populate null borrowernumbers using a fairly
conservative approach, only where exactly one match exists, else warns.

The process of updating statistics is needlessly complex based on the
lack of a reliable primary key.  ALL such tables should have a numerical
primary key.  The impression that the timestamp and any other fields
are enough to combine for a "unique enough" key is wrong.  For example,
running SIP tests will add multiple transactions that might share
borrowernumber, itemnumber and timestamp.  Key uniqueness should be
logically inherent, not de facto.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
installer/data/mysql/backfill_statistics.pl [new file with mode: 0755]