[open-ils-commits] r16752 - in trunk/Open-ILS/src/sql/Pg: . upgrade (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jun 18 10:59:14 EDT 2010
Author: scottmk
Date: 2010-06-18 10:59:12 -0400 (Fri, 18 Jun 2010)
New Revision: 16752
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/008.schema.query.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
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
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-18 14:54:24 UTC (rev 16751)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-18 14:59:12 UTC (rev 16752)
@@ -68,7 +68,7 @@
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,
Modified: trunk/Open-ILS/src/sql/Pg/008.schema.query.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/008.schema.query.sql 2010-06-18 14:54:24 UTC (rev 16751)
+++ trunk/Open-ILS/src/sql/Pg/008.schema.query.sql 2010-06-18 14:59:12 UTC (rev 16752)
@@ -67,6 +67,10 @@
( 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
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-06-18 14:54:24 UTC (rev 16751)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-06-18 14:59:12 UTC (rev 16752)
@@ -5538,3 +5538,75 @@
'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);
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0311.data.query-seed-datatypes.sql 2010-06-18 14:59:12 UTC (rev 16752)
@@ -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;
More information about the open-ils-commits
mailing list