From 9e10a47cb6d26b8ada30685cc00fec1ab7a93a2b Mon Sep 17 00:00:00 2001 From: gmc Date: Thu, 10 Jun 2010 13:18:23 +0000 Subject: [PATCH] drop copy transparency tables These tables were never used. Signed-of-by: Galen Charlton git-svn-id: svn://svn.open-ils.org/ILS/trunk@16646 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/040.schema.asset.sql | 25 ---------------------- .../upgrade/0301.schema.drop_copy_transparency.sql | 17 +++++++++++++++ 3 files changed, 18 insertions(+), 26 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0301.schema.drop_copy_transparency.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index f39205364e..06207450d2 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 ('0300'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0301'); -- gmc CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 70c0e73fe1..fcb053e030 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -101,31 +101,6 @@ CREATE TRIGGER acp_status_changed_trig BEFORE UPDATE ON asset.copy FOR EACH ROW EXECUTE PROCEDURE asset.acp_status_changed(); -CREATE TABLE asset.copy_transparency ( - id SERIAL PRIMARY KEY, - deposit_amount NUMERIC(6,2), - owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, - circ_lib INT REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, - loan_duration INT CHECK ( loan_duration IN (1,2,3) ), - fine_level INT CHECK ( fine_level IN (1,2,3) ), - holdable BOOL, - circulate BOOL, - deposit BOOL, - ref BOOL, - opac_visible BOOL, - circ_modifier TEXT, - circ_as_type TEXT, - name TEXT NOT NULL, - CONSTRAINT scte_name_once_per_lib UNIQUE (owner,name) -); - -CREATE TABLE asset.copy_transparency_map ( - id BIGSERIAL PRIMARY KEY, - transparency INT NOT NULL REFERENCES asset.copy_transparency (id) DEFERRABLE INITIALLY DEFERRED, - target_copy INT NOT NULL UNIQUE REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED -); -CREATE INDEX cp_tr_cp_idx ON asset.copy_transparency_map (transparency); - CREATE TABLE asset.stat_cat_entry_transparency_map ( id BIGSERIAL PRIMARY KEY, stat_cat INT NOT NULL, -- needs ON DELETE CASCADE diff --git a/Open-ILS/src/sql/Pg/upgrade/0301.schema.drop_copy_transparency.sql b/Open-ILS/src/sql/Pg/upgrade/0301.schema.drop_copy_transparency.sql new file mode 100644 index 0000000000..2e63f3d1d5 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0301.schema.drop_copy_transparency.sql @@ -0,0 +1,17 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0301'); -- gmc + +CREATE TEMPORARY TABLE eg_0301_check_if_has_contents ( + flag INTEGER PRIMARY KEY +) ON COMMIT DROP; +INSERT INTO eg_0301_check_if_has_contents VALUES (1); + +-- cause failure if either of the tables we want to drop have rows +INSERT INTO eg_0301_check_if_has_contents SELECT 1 FROM asset.copy_transparency LIMIT 1; +INSERT INTO eg_0301_check_if_has_contents SELECT 1 FROM asset.copy_transparency_map LIMIT 1; + +DROP TABLE asset.copy_transparency_map; +DROP TABLE asset.copy_transparency; + +COMMIT; -- 2.11.0