From: Galen Charlton Date: Tue, 1 Oct 2019 21:15:36 +0000 (-0400) Subject: LP#1839002: stamp DB update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=289922394d5567aa47fb672a7f2792c61898483e;p=evergreen%2Fpines.git LP#1839002: stamp DB update Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 3e9e1996d2..7b8db1d6f2 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1187', :eg_version); -- Dyrcona/gmcharlt +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1188', :eg_version); -- Dyrcona/gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1188.schema.action_circulation-auto_renewal-default-false.sql b/Open-ILS/src/sql/Pg/upgrade/1188.schema.action_circulation-auto_renewal-default-false.sql new file mode 100644 index 0000000000..67f916c2c8 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1188.schema.action_circulation-auto_renewal-default-false.sql @@ -0,0 +1,20 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('1188', :eg_version); + +UPDATE action.circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL; + +UPDATE action.aged_circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL; + +COMMIT; + +-- The following two changes cannot occur in a transaction with the +-- above updates because we will get an error about not being able to +-- alter a table with pending transactions. They also need to occur +-- after the above updates or the SET NOT NULL change will fail. + +ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE; +ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET NOT NULL; + +ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE; +ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET NOT NULL; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action_circulation-auto_renewal-default-false.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action_circulation-auto_renewal-default-false.sql deleted file mode 100644 index e5fc738084..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action_circulation-auto_renewal-default-false.sql +++ /dev/null @@ -1,20 +0,0 @@ -BEGIN; - ---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); - -UPDATE action.circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL; - -UPDATE action.aged_circulation SET auto_renewal = FALSE WHERE auto_renewal IS NULL; - -COMMIT; - --- The following two changes cannot occur in a transaction with the --- above updates because we will get an error about not being able to --- alter a table with pending transactions. They also need to occur --- after the above updates or the SET NOT NULL change will fail. - -ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE; -ALTER TABLE action.circulation ALTER COLUMN auto_renewal SET NOT NULL; - -ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET DEFAULT FALSE; -ALTER TABLE action.aged_circulation ALTER COLUMN auto_renewal SET NOT NULL;