From: scottmk Date: Wed, 2 Dec 2009 16:55:53 +0000 (+0000) Subject: Add three more tables to the query schema: record_column, select_item, X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ebfc1feab081ff7554844a1d947daecbac1858a7;p=evergreen%2Fbjwebb.git Add three more tables to the query schema: record_column, select_item, and order_by_item. M Open-ILS/src/sql/Pg/002.schema.config.sql A Open-ILS/src/sql/Pg/upgrade/0102.schema.query-col-sel-order.sql M Open-ILS/examples/fm_IDL.xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@15059 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 3682e7ca3..1597a445e 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -5508,6 +5508,54 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 8d046713d..9842d8af7 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0101'); -- berick +INSERT INTO config.upgrade_log (version) VALUES ('0102'); -- Scott McKellar CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0102.schema.query-col-sel-order.sql b/Open-ILS/src/sql/Pg/upgrade/0102.schema.query-col-sel-order.sql new file mode 100644 index 000000000..d21f8586f --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0102.schema.query-col-sel-order.sql @@ -0,0 +1,45 @@ +-- Script to create the query schema and the tables therein + +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0102'); -- Scott McKellar + +CREATE TABLE query.record_column ( + id SERIAL PRIMARY KEY, + from_relation INT NOT NULL REFERENCES query.from_relation + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + seq_no INT NOT NULL, + column_name TEXT NOT NULL, + column_type INT NOT NULL REFERENCES query.datatype + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT column_sequence UNIQUE (from_relation, seq_no) +); + +CREATE TABLE query.select_item ( + id SERIAL PRIMARY KEY, + stored_query INT NOT NULL REFERENCES query.stored_query + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + seq_no INT NOT NULL, + expression INT NOT NULL REFERENCES query.expression + DEFERRABLE INITIALLY DEFERRED, + column_alias TEXT, + grouped_by BOOL NOT NULL DEFAULT FALSE, + CONSTRAINT select_sequence UNIQUE( stored_query, seq_no ) +); + +CREATE TABLE query.order_by_item ( + id SERIAL PRIMARY KEY, + stored_query INT NOT NULL REFERENCES query.stored_query + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + seq_no INT NOT NULL, + expression INT NOT NULL REFERENCES query.expression + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT order_by_sequence UNIQUE( stored_query, seq_no ) +); + +COMMIT;