From: Galen Charlton Date: Fri, 20 May 2011 01:28:50 +0000 (-0400) Subject: add missing upgrade step to create staging schema X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8ac7fa0c1a8588e4e82f1cf5564dfef52e5ae0d7;p=evergreen%2Ftadl.git add missing upgrade step to create staging schema Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql index 28c45bad45..1302226764 100644 --- a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql @@ -18971,6 +18971,69 @@ CREATE TRIGGER autogenerate_placeholder_barcode COMMIT; +BEGIN; +-- stick loading the staging schema into a separate transaction, as +-- libraries upgrading from earlier stock versions of Evergreen won't have +-- it, but at least one library is known to have it in a pre-2.0 variant +-- setup. +CREATE SCHEMA staging; + +CREATE TABLE staging.user_stage ( + row_id BIGSERIAL PRIMARY KEY, + row_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + usrname TEXT NOT NULL, + profile TEXT, + email TEXT, + passwd TEXT, + ident_type INT DEFAULT 3, + first_given_name TEXT, + second_given_name TEXT, + family_name TEXT, + day_phone TEXT, + evening_phone TEXT, + home_ou INT DEFAULT 2, + dob TEXT, + complete BOOL DEFAULT FALSE +); + +CREATE TABLE staging.card_stage ( -- for new library barcodes + row_id BIGSERIAL PRIMARY KEY, + row_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + usrname TEXT NOT NULL, + barcode TEXT NOT NULL, + complete BOOL DEFAULT FALSE +); + +CREATE TABLE staging.mailing_address_stage ( + row_id BIGSERIAL PRIMARY KEY, + row_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + usrname TEXT NOT NULL, -- user's SIS barcode, for linking + street1 TEXT, + street2 TEXT, + city TEXT NOT NULL DEFAULT '', + state TEXT NOT NULL DEFAULT 'OK', + country TEXT NOT NULL DEFAULT 'US', + post_code TEXT NOT NULL, + complete BOOL DEFAULT FALSE +); + +CREATE TABLE staging.billing_address_stage ( + LIKE staging.mailing_address_stage INCLUDING DEFAULTS +); + +ALTER TABLE staging.billing_address_stage ADD PRIMARY KEY (row_id); + +CREATE TABLE staging.statcat_stage ( + row_id BIGSERIAL PRIMARY KEY, + row_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + usrname TEXT NOT NULL, + statcat TEXT NOT NULL, -- for things like 'Year of study' + value TEXT NOT NULL, -- and the value, such as 'Freshman' + complete BOOL DEFAULT FALSE +); + +COMMIT; + -- Some operations go outside of the transaction, because they may -- legitimately fail.