From 29b0c0f979f658ca965b70a703f8a972d375e172 Mon Sep 17 00:00:00 2001 From: scottmk Date: Fri, 18 Jun 2010 14:59:12 +0000 Subject: [PATCH] Define some stock datatypes in query.datatype. Set the sequence for query.datatype to leave room for more stock datatypes if we want to add them. M Open-ILS/src/sql/Pg/002.schema.config.sql M Open-ILS/src/sql/Pg/008.schema.query.sql A Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql M Open-ILS/src/sql/Pg/950.data.seed-values.sql git-svn-id: svn://svn.open-ils.org/ILS/trunk@16752 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/008.schema.query.sql | 4 ++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 72 +++++++++++++++++++ .../Pg/upgrade/0311.data.query-seed-datatypes.sql | 82 ++++++++++++++++++++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index b0422c57f..67f2292de 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0310'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0311'); -- Scott McKellar CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/008.schema.query.sql b/Open-ILS/src/sql/Pg/008.schema.query.sql index 2d2ef4dbb..be97141d2 100644 --- a/Open-ILS/src/sql/Pg/008.schema.query.sql +++ b/Open-ILS/src/sql/Pg/008.schema.query.sql @@ -67,6 +67,10 @@ CREATE TABLE query.datatype ( ( is_numeric IS FALSE OR is_composite IS FALSE ) ); +-- Leave room to seed with stock datatypes +-- before adding customized ones +SELECT setval( 'query.datatype_id_seq', 1000 ); + CREATE TABLE query.subfield ( id SERIAL PRIMARY KEY, composite_type INT NOT NULL diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 450f95475..262633c83 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -5538,3 +5538,75 @@ VALUES ( 'interval' ); +-- 0311.data.query-seed-datatypes.sql +-- Define the most common datatypes in query.datatype. Note that none of +-- these stock datatypes specifies a width or precision. + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (1, 'SMALLINT', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (2, 'INTEGER', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (3, 'BIGINT', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (4, 'DECIMAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (5, 'NUMERIC', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (6, 'REAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (7, 'DOUBLE PRECISION', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (8, 'SERIAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (9, 'BIGSERIAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (10, 'MONEY', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (11, 'VARCHAR', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (12, 'CHAR', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (13, 'TEXT', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (14, '"char"', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (15, 'NAME', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (16, 'BYTEA', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (17, 'TIMESTAMP WITHOUT TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (18, 'TIMESTAMP WITH TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (19, 'DATE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (20, 'TIME WITHOUT TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (21, 'TIME WITH TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (22, 'INTERVAL', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (23, 'BOOLEAN', false); diff --git a/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql b/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql new file mode 100644 index 000000000..bd102d93a --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql @@ -0,0 +1,82 @@ +BEGIN; + +-- Define the most common datatypes in query.datatype. Note that none of +-- these stock datatypes specifies a width or precision. + +-- Also: set the sequence for query.datatype to 1000, leaving plenty of +-- room for more stock datatypes if we ever want to add them. + +INSERT INTO config.upgrade_log (version) VALUES ('0311'); -- Scott McKellar + +SELECT setval( 'query.datatype_id_seq', 1000 ); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (1, 'SMALLINT', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (2, 'INTEGER', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (3, 'BIGINT', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (4, 'DECIMAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (5, 'NUMERIC', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (6, 'REAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (7, 'DOUBLE PRECISION', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (8, 'SERIAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (9, 'BIGSERIAL', true); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (10, 'MONEY', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (11, 'VARCHAR', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (12, 'CHAR', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (13, 'TEXT', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (14, '"char"', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (15, 'NAME', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (16, 'BYTEA', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (17, 'TIMESTAMP WITHOUT TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (18, 'TIMESTAMP WITH TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (19, 'DATE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (20, 'TIME WITHOUT TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (21, 'TIME WITH TIME ZONE', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (22, 'INTERVAL', false); + +INSERT INTO query.datatype (id, datatype_name, is_numeric ) + VALUES (23, 'BOOLEAN', false); + +COMMIT; -- 2.11.0