[open-ils-commits] r14129 - in trunk/Open-ILS: examples src/sql/Pg src/sql/Pg/upgrade (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 23 13:56:42 EDT 2009
Author: scottmk
Date: 2009-09-23 13:56:38 -0400 (Wed, 23 Sep 2009)
New Revision: 14129
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0017.schema.circ-target-copy-indexes.sql
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
Log:
Create two new indexes on action.circulation & action.aged_circulation,
and a virtual view for counting circulations by year.
M Open-ILS/src/sql/Pg/002.schema.config.sql
A Open-ILS/src/sql/Pg/upgrade/0017.schema.circ-target-copy-indexes.sql
M Open-ILS/examples/fm_IDL.xml
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-09-23 16:48:26 UTC (rev 14128)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-09-23 17:56:38 UTC (rev 14129)
@@ -5132,6 +5132,51 @@
</links>
</class>
+ <class id="circbyyr" controller="open-ils.cstore" oils_obj:fieldmapper="action::circ_counts_by_year" oils_persist:tablename="action.circ_counts_by_year" oils_persist:readonly="true">
+ <oils_persist:source_definition>
+
+ SELECT id, SUM(count) AS count, year, is_renewal FROM (
+ SELECT
+ cp.id,
+ COUNT(circ.id),
+ EXTRACT(YEAR FROM circ.xact_start) AS year,
+ (phone_renewal OR desk_renewal OR opac_renewal) as is_renewal
+ FROM
+ asset.copy cp
+ JOIN action.circulation circ ON (cp.id = circ.target_copy)
+ GROUP BY 1, 3, 4
+ UNION
+ SELECT
+ cp.id,
+ COUNT(circ.id),
+ EXTRACT(YEAR FROM circ.xact_start) AS year,
+ (phone_renewal OR desk_renewal OR opac_renewal) as is_renewal
+ FROM
+ asset.copy cp
+ JOIN action.aged_circulation circ ON (cp.id = circ.target_copy)
+ GROUP BY 1, 3, 4
+ UNION
+ SELECT
+ id,
+ circ_count,
+ -1 AS year,
+ false as is_renewal
+ FROM
+ extend_reporter.legacy_circ_count
+ )x GROUP BY 1, 3, 4
+
+ </oils_persist:source_definition>
+ <fields>
+ <field reporter:label="Copy ID" name="id" reporter:datatype="link"/>
+ <field reporter:label="Count" name="count" reporter:datatype="int"/>
+ <field reporter:label="Year" name="year" reporter:datatype="int"/>
+ <field reporter:label="Renewal" name="is_renewal" reporter:datatype="bool"/>
+ </fields>
+ <links>
+ <link field="id" reltype="has_a" key="id" map="" class="acp"/>
+ </links>
+ </class>
+
<class id="rodcirc" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::overdue_circs" oils_persist:tablename="reporter.overdue_circs" reporter:core="true" reporter:label="Overdue Circulation">
<fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
<field reporter:label="Check In Library" name="checkin_lib" reporter:datatype="org_unit"/>
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-23 16:48:26 UTC (rev 14128)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-23 17:56:38 UTC (rev 14129)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0016');
+INSERT INTO config.upgrade_log (version) VALUES ('0017');
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0017.schema.circ-target-copy-indexes.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0017.schema.circ-target-copy-indexes.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0017.schema.circ-target-copy-indexes.sql 2009-09-23 17:56:38 UTC (rev 14129)
@@ -0,0 +1,11 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0017');
+
+CREATE INDEX action_circulation_target_copy_idx
+ON action.circulation (target_copy);
+
+CREATE INDEX action_aged_circulation_target_copy_idx ON
+ON action.aged_circulation (target_copy);
+
+COMMIT;
More information about the open-ils-commits
mailing list