LP1902937: Modify New Schema Upgrade SQL scripts collab/dyrcona/lp1902937-quipu-integration+erenew
authorJason Stephenson <jason@sigio.com>
Fri, 27 Jan 2023 18:49:29 +0000 (13:49 -0500)
committerJason Stephenson <jason@sigio.com>
Thu, 6 Apr 2023 18:32:30 +0000 (14:32 -0400)
Alter schema upgrade that adds the erenew column to set the column
"NOT NULL DEFAULT FALSE."  Remove the extra updates to set the current
column values to FALSE and add the NOT NULL constraint.  This new
version does it all in 1 ALTER TABLE statement.

Rename the Quipu standing penalty and erenew pgt column upgrade
scripts so that the order that they should be run is obvious from the
filenames.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/sql/Pg/upgrade/XXXX-quipu-standing_penalty.sql [deleted file]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.erenew_column_pgt.sql [deleted file]
Open-ILS/src/sql/Pg/upgrade/YYYY.quipu-standing-penalty.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.erenew_column_pgt.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX-quipu-standing_penalty.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX-quipu-standing_penalty.sql
deleted file mode 100644 (file)
index e7d82fd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-BEGIN;
-
--- ID has to be under 100 in order to prevent it from appearing as a dropdown in the patron editor.
-
-INSERT INTO config.standing_penalty (id, name, label, staff_alert, org_depth) 
-VALUES (90, 'PATRON_TEMP_RENEWAL',
-       'Patron was given a 30-day temporary account renewal. 
-       Please archive this message after the account is fully renewed.', TRUE, 0
-       );
-
-COMMIT;
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.erenew_column_pgt.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.erenew_column_pgt.sql
deleted file mode 100644 (file)
index cf58401..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-BEGIN;
-
-ALTER TABLE permission.grp_tree ADD COLUMN erenew BOOL;
-
-COMMIT;
-
-BEGIN;
-
-UPDATE permission.grp_tree SET erenew = FALSE;
-
-COMMIT;
-
-BEGIN;
-
-ALTER TABLE permission.grp_tree ALTER COLUMN erenew SET NOT NULL;
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.quipu-standing-penalty.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.quipu-standing-penalty.sql
new file mode 100644 (file)
index 0000000..e7d82fd
--- /dev/null
@@ -0,0 +1,11 @@
+BEGIN;
+
+-- ID has to be under 100 in order to prevent it from appearing as a dropdown in the patron editor.
+
+INSERT INTO config.standing_penalty (id, name, label, staff_alert, org_depth) 
+VALUES (90, 'PATRON_TEMP_RENEWAL',
+       'Patron was given a 30-day temporary account renewal. 
+       Please archive this message after the account is fully renewed.', TRUE, 0
+       );
+
+COMMIT;
\ No newline at end of file
diff --git a/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.erenew_column_pgt.sql b/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.erenew_column_pgt.sql
new file mode 100644 (file)
index 0000000..c047b32
--- /dev/null
@@ -0,0 +1,5 @@
+BEGIN;
+
+ALTER TABLE permission.grp_tree ADD COLUMN erenew BOOL NOT NULL DEFAULT FALSE;
+
+COMMIT;