From: miker Date: Fri, 13 Jun 2008 13:40:46 +0000 (+0000) Subject: adding copyright statement headers to the schema definition files; forward porting... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6783fe66a9ea89296d304d9e04e0db256a904cb5;p=Evergreen.git adding copyright statement headers to the schema definition files; forward porting extend_reporter schema and example git-svn-id: svn://svn.open-ils.org/ILS/trunk@9828 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 611d0f25a2..3d7f8e4091 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3379,6 +3379,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/000.english.pg80.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg80.fts-config.sql index c15bcf1265..a7f47771cc 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg80.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg80.fts-config.sql @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ BEGIN; diff --git a/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql index c15bcf1265..d42ff973fc 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; diff --git a/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql index c15bcf1265..d42ff973fc 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; diff --git a/Open-ILS/src/sql/Pg/001.schema.offline.sql b/Open-ILS/src/sql/Pg/001.schema.offline.sql index 8bd18089ff..51f2e40613 100644 --- a/Open-ILS/src/sql/Pg/001.schema.offline.sql +++ b/Open-ILS/src/sql/Pg/001.schema.offline.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA offline CASCADE; diff --git a/Open-ILS/src/sql/Pg/002.functions.config.sql b/Open-ILS/src/sql/Pg/002.functions.config.sql index a4d186f392..b70da55e3f 100644 --- a/Open-ILS/src/sql/Pg/002.functions.config.sql +++ b/Open-ILS/src/sql/Pg/002.functions.config.sql @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + + BEGIN; /* diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index a6760e1f00..7b5aeac889 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + + DROP SCHEMA stats CASCADE; DROP SCHEMA config CASCADE; diff --git a/Open-ILS/src/sql/Pg/006.schema.permissions.sql b/Open-ILS/src/sql/Pg/006.schema.permissions.sql index a873d47ef1..a07bdf5694 100644 --- a/Open-ILS/src/sql/Pg/006.schema.permissions.sql +++ b/Open-ILS/src/sql/Pg/006.schema.permissions.sql @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + + DROP SCHEMA permission CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/010.schema.biblio.sql b/Open-ILS/src/sql/Pg/010.schema.biblio.sql index b727339303..4a9794e8ad 100644 --- a/Open-ILS/src/sql/Pg/010.schema.biblio.sql +++ b/Open-ILS/src/sql/Pg/010.schema.biblio.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA biblio CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql index 2b2013d2e5..6ffc574904 100644 --- a/Open-ILS/src/sql/Pg/011.schema.authority.sql +++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA authority CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql index 0ba1add6e4..7796c01577 100644 --- a/Open-ILS/src/sql/Pg/020.schema.functions.sql +++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + CREATE OR REPLACE FUNCTION public.non_filing_normalize ( TEXT, "char" ) RETURNS TEXT AS $$ SELECT SUBSTRING( REGEXP_REPLACE( diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql b/Open-ILS/src/sql/Pg/030.schema.metabib.sql index f51109dfed..27f2586618 100644 --- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql +++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA metabib CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 1a17d9e559..0146072812 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA asset CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/070.schema.container.sql b/Open-ILS/src/sql/Pg/070.schema.container.sql index d8acdd99af..983c44769b 100644 --- a/Open-ILS/src/sql/Pg/070.schema.container.sql +++ b/Open-ILS/src/sql/Pg/070.schema.container.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA container CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql index 24d6b581d4..b0da2dac4b 100644 --- a/Open-ILS/src/sql/Pg/080.schema.money.sql +++ b/Open-ILS/src/sql/Pg/080.schema.money.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA money CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 76e7c49a63..6ef3673684 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA action CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql new file mode 100644 index 0000000000..cb6adb3e4f --- /dev/null +++ b/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +BEGIN; + +CREATE SCHEMA extend_reporter; + +CREATE TABLE extend_reporter.legcay_circ_count ( + id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id) + circ_count INT NOT NULL DEFAULT 0 +); + +CREATE VIEW extend_reporter.full_circ_count AS + SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) AS circ_count + FROM asset."copy" cp + LEFT JOIN extend_reporter.legcay_circ_count c USING (id) + LEFT JOIN "action".circulation circ ON circ.target_copy = c.id + GROUP BY cp.id; + +COMMIT; + diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql index 50f3a05842..ec5bdd32c5 100644 --- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql +++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA search CASCADE; diff --git a/Open-ILS/src/sql/Pg/500.view.cross-schema.sql b/Open-ILS/src/sql/Pg/500.view.cross-schema.sql index 23c2b2c17f..cfbcf48f18 100644 --- a/Open-ILS/src/sql/Pg/500.view.cross-schema.sql +++ b/Open-ILS/src/sql/Pg/500.view.cross-schema.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; CREATE OR REPLACE VIEW money.open_billable_xact_summary AS diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index e0309841df..2679d69b69 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Copyright (C) 2008 Laurentian University + * Mike Rylander + * Dan Scott + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_mailing_address_fkey FOREIGN KEY (mailing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED; diff --git a/Open-ILS/src/sql/Pg/900.audit-functions.sql b/Open-ILS/src/sql/Pg/900.audit-functions.sql index 802516fe90..df4acd7c03 100644 --- a/Open-ILS/src/sql/Pg/900.audit-functions.sql +++ b/Open-ILS/src/sql/Pg/900.audit-functions.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA auditor CASCADE; BEGIN; diff --git a/Open-ILS/src/sql/Pg/901.audit-tables.sql b/Open-ILS/src/sql/Pg/901.audit-tables.sql index d0cef3fd90..987a18ee41 100644 --- a/Open-ILS/src/sql/Pg/901.audit-tables.sql +++ b/Open-ILS/src/sql/Pg/901.audit-tables.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; SELECT auditor.create_auditor ( 'actor', 'usr' ); diff --git a/Open-ILS/src/sql/Pg/example.reporter-extension.sql b/Open-ILS/src/sql/Pg/example.reporter-extension.sql index 00c79e4e6f..2bffcef310 100644 --- a/Open-ILS/src/sql/Pg/example.reporter-extension.sql +++ b/Open-ILS/src/sql/Pg/example.reporter-extension.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + BEGIN; CREATE OR REPLACE VIEW reporter.classic_current_circ AS diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql new file mode 100644 index 0000000000..90fcd2d032 --- /dev/null +++ b/Open-ILS/src/sql/Pg/extend-reporter.sql @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +DROP SCHEMA extend_reporter CASCADE; + +BEGIN; + +CREATE SCHEMA extend_reporter; + +CREATE TABLE extend_reporter.legcay_circ_count ( + id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id) + circ_count INT NOT NULL DEFAULT 0 +); + +CREATE VIEW extend_reporter.full_circ_count AS + SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) AS circ_count + FROM asset."copy" cp + LEFT JOIN extend_reporter.legcay_circ_count c USING (id) + LEFT JOIN "action".circulation circ ON circ.target_copy = c.id + GROUP BY cp.id; + +COMMIT; + diff --git a/Open-ILS/src/sql/Pg/reporter-schema.sql b/Open-ILS/src/sql/Pg/reporter-schema.sql index 3fc2e22f14..f2101ef96e 100644 --- a/Open-ILS/src/sql/Pg/reporter-schema.sql +++ b/Open-ILS/src/sql/Pg/reporter-schema.sql @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2007-2008 Equinox Software, Inc. + * Mike Rylander + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + DROP SCHEMA reporter CASCADE; BEGIN;