LP#1719726: Retain the ingest.disable_authority_full_rec internal flag if it was...
authorMike Rylander <mrylander@gmail.com>
Wed, 27 Sep 2017 18:26:00 +0000 (14:26 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 27 Sep 2017 19:50:10 +0000 (15:50 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql

index df2ac2d..ae619d9 100644 (file)
@@ -7128,6 +7128,11 @@ SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE,
 \echo you should consult this upgrade script for the reingest actions required.
 BEGIN;
 
 \echo you should consult this upgrade script for the reingest actions required.
 BEGIN;
 
+-- add the flag ingest.disable_authority_full_rec if it does not exist
+INSERT INTO config.internal_flag (name, enabled)
+SELECT 'ingest.disable_authority_full_rec', FALSE
+WHERE NOT EXISTS (SELECT 1 FROM config.internal_flag WHERE name = 'ingest.disable_authority_full_rec');
+
 CREATE TEMPORARY TABLE internal_flag_state AS
     SELECT name, enabled
     FROM config.internal_flag
 CREATE TEMPORARY TABLE internal_flag_state AS
     SELECT name, enabled
     FROM config.internal_flag
@@ -7137,11 +7142,6 @@ CREATE TEMPORARY TABLE internal_flag_state AS
         'ingest.disable_authority_full_rec'
     );
 
         'ingest.disable_authority_full_rec'
     );
 
--- work around fact that ingest.disable_authority_full_rec may not exist
-INSERT INTO config.internal_flag (name, enabled)
-SELECT 'ingest.disable_authority_full_rec', TRUE
-WHERE NOT EXISTS (SELECT 1 FROM config.internal_flag WHERE name = 'ingest.disable_authority_full_rec');
-
 UPDATE config.internal_flag
 SET enabled = TRUE
 WHERE name in (
 UPDATE config.internal_flag
 SET enabled = TRUE
 WHERE name in (
@@ -7168,8 +7168,4 @@ SET enabled = b.enabled
 FROM internal_flag_state b
 WHERE a.name = b.name;
 
 FROM internal_flag_state b
 WHERE a.name = b.name;
 
-DELETE FROM config.internal_flag
-WHERE name = 'ingest.disable_authority_full_rec'
-AND NOT EXISTS (SELECT 1 FROM internal_flag_state WHERE name = 'ingest.disable_authority_full_rec');
-
 COMMIT;
 COMMIT;