[open-ils-commits] r17715 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 15 20:40:51 EDT 2010
Author: miker
Date: 2010-09-15 20:40:50 -0400 (Wed, 15 Sep 2010)
New Revision: 17715
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0403.schema.serials-tweaks.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql
Log:
Patch from Dan Wells:
I will start with the changes which I think are straightforward. First, textual_holdings are sometimes used to augment the generated_coverage and at other times should completely replace it (generally when the holdings statement is too complex to be easily generated or has more detail than we care about). The 'show_generated' flag in each summary table is a simple means of indicating which type of display we want. Second, 'summary_method' will be consulted when generating the 'generated_coverage' fields, and tells us how any attached MFHD records (SREs) should be treated for this distribution in relation to the new structured data (attempt to merge the data, generate display data from both separately, or generate based on one or the other only).
The changes to serial.caption_and_pattern are not as straightforward, but I think they are justifiable. Any given caption/pattern is only valid for a certain period of time (i.e. until it changes). As it stands, we can infer the start and end dates of a caption/pattern only by consulting the attached issuances. In practice this means retrieving and sorting sometimes hundreds of issuances to provide for the sorted display of just a few caption/patterns. As I work with these objects more, I am simply often wishing for a more convenient access point to this important data. This also means that the 'active' flag is redundant (caption/patterns with end_date-s are not active), but we need to get end_date in place before we can start removing the 'active' flag from the code.
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-09-15 22:06:37 UTC (rev 17714)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-09-16 00:40:50 UTC (rev 17715)
@@ -68,7 +68,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0402'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0403'); -- dbwells via miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-09-15 22:06:37 UTC (rev 17714)
+++ trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-09-16 00:40:50 UTC (rev 17715)
@@ -68,6 +68,8 @@
CONSTRAINT cap_type CHECK ( type in
( 'basic', 'supplement', 'index' )),
create_date TIMESTAMPTZ NOT NULL DEFAULT now(),
+ start_date TIMESTAMPTZ NOT NULL DEFAULT now(),
+ end_date TIMESTAMPTZ,
active BOOL NOT NULL DEFAULT FALSE,
pattern_code TEXT NOT NULL, -- must contain JSON
enum_1 TEXT,
@@ -90,6 +92,11 @@
record_entry BIGINT REFERENCES serial.record_entry (id)
ON DELETE SET NULL
DEFERRABLE INITIALLY DEFERRED,
+ summary_method TEXT CONSTRAINT sdist_summary_method_check
+ CHECK (summary_method IS NULL
+ OR summary_method IN ( 'add_to_sre',
+ 'merge_with_sre', 'use_sre_only',
+ 'use_sdist_only')),
subscription INT NOT NULL
REFERENCES serial.subscription (id)
ON DELETE CASCADE
@@ -274,7 +281,8 @@
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
generated_coverage TEXT NOT NULL,
- textual_holdings TEXT
+ textual_holdings TEXT,
+ show_generated BOOL NOT NULL DEFAULT TRUE
);
CREATE INDEX serial_basic_summary_dist_idx ON serial.basic_summary (distribution);
@@ -285,7 +293,8 @@
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
generated_coverage TEXT NOT NULL,
- textual_holdings TEXT
+ textual_holdings TEXT,
+ show_generated BOOL NOT NULL DEFAULT TRUE
);
CREATE INDEX serial_supplement_summary_dist_idx ON serial.supplement_summary (distribution);
@@ -296,7 +305,8 @@
ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
generated_coverage TEXT NOT NULL,
- textual_holdings TEXT
+ textual_holdings TEXT,
+ show_generated BOOL NOT NULL DEFAULT TRUE
);
CREATE INDEX serial_index_summary_dist_idx ON serial.index_summary (distribution);
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0403.schema.serials-tweaks.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0403.schema.serials-tweaks.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0403.schema.serials-tweaks.sql 2010-09-16 00:40:50 UTC (rev 17715)
@@ -0,0 +1,35 @@
+-- serials schema tweaks
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0403'); -- dbwells via miker
+
+------- caption_and_pattern changes
+ALTER TABLE serial.caption_and_pattern
+ADD COLUMN start_date TIMESTAMP WITH TIME ZONE DEFAULT NOW();
+
+ALTER TABLE serial.caption_and_pattern
+ADD COLUMN end_date TIMESTAMP WITH TIME ZONE;
+
+
+------- *_summary changes
+ALTER TABLE serial.basic_summary
+ADD COLUMN show_generated BOOL NOT NULL DEFAULT TRUE;
+
+ALTER TABLE serial.supplement_summary
+ADD COLUMN show_generated BOOL NOT NULL DEFAULT TRUE;
+
+ALTER TABLE serial.index_summary
+ADD COLUMN show_generated BOOL NOT NULL DEFAULT TRUE;
+
+
+------- distribution changes
+ALTER TABLE serial.distribution
+
+ADD COLUMN summary_method TEXT CONSTRAINT summary_method_check CHECK (
+ summary_method IS NULL
+ OR summary_method IN ( 'add_to_sre',
+ 'merge_with_sre', 'use_sre_only',
+ 'use_sdist_only'));
+
+COMMIT;
More information about the open-ils-commits
mailing list