]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-835: Update UOC migration script: Migrate userGroup.userType
authorLam Voong <lkv@berkeley.edu>
Mon, 18 May 2020 17:53:11 +0000 (10:53 -0700)
committerGitHub <noreply@github.com>
Mon, 18 May 2020 17:53:11 +0000 (10:53 -0700)
Add migration notes for userGroup.
Add command to migration userGroup.userType to userGroup.userInstitutionRole.

src/main/resources/db/postgresql/upgrade/6.0.0/post-init/05_uoc.sql

index 18b0b124cb41320b15d9c553b5c6791c47e8044f..07fdaa6e93925832b6041cf8088d851595a819ac 100644 (file)
@@ -31,7 +31,7 @@
 
     public.uoc_common ============> MIGRATION NEEDED: various fields updated to repeatable fields/groups.
     public.uoc_common_methodlist => NO MIGRATION NEEDED.
-    public.usergroup =============> NO MIGRATION NEEDED, although 3 new fields were added to the table.
+    public.usergroup =============> MIGRATION NEEDED: 3 new fields added; MIGRATE userType to userInstitutionRole
 
 -- Version 5.2 uoc_common table description and migration note:
 
@@ -392,4 +392,48 @@ BEGIN
 END
 $$;
 
+/* Version 5.2 usergroup table description and migration note:
+
+   -- Version 5.2 usergroup table description:
+
+                             Table "public.usergroup"
+          Column  |         Type          | Collation | Nullable | Migration Note
+        ----------+-----------------------+-----------+----------+--------------------------------
+         id       | character varying(36) |           | not null |
+         usertype | character varying     |           |          | MIGRATE to userinstitutionrole
+         user     | character varying     |           |          |
+        Indexes:
+            "usergroup_pk" PRIMARY KEY, btree (id)
+        Foreign-key constraints:
+            "usergroup_id_hierarchy_fk" FOREIGN KEY (id) REFERENCES hierarchy(id) ON DELETE CASCADE
+
+   -- NEW usergroup table description:
+
+                        Table "public.usergroup"
+               Column        |         Type          | Modifiers | Migration Note
+        ---------------------+-----------------------+-----------+--------------------------------
+         id                  | character varying(36) | not null  | NO CHANGE
+         usertype            | character varying     |           | MIGRATE to userinstitutionrole
+         user                | character varying     |           | NO CHANGE
+         userinstitution     | character varying     |           | NEW COLUMN
+         userrole            | character varying     |           | NEW COLUMN
+         userinstitutionrole | character varying     |           | NEW; MIGRATE from usertype
+         useruocrole         | character varying     |           | NEW COLUMN
+        Indexes:
+            "usergroup_pk" PRIMARY KEY, btree (id)
+        Foreign-key constraints:
+            "usergroup_id_hierarchy_fk" FOREIGN KEY (id) REFERENCES hierarchy(id) ON DELETE CASCADE
+
+    -- Migration Note:
+
+       Three new columns were added for User Role, User Institution Role, and User Use of Collections role.
+       Instead of re-nameing the userType column to userInstitutionRole, the old column will remain, and
+       the userType data is migrated to userInstitutionRole.
+*/
+
+-- Migrate v5.2 UOC User Type data from userType to userInstitutionRole in the userGroup table:
+
+update usergroup
+set userinstitutionrole = usertype;
+
 -- END OF MIGRATION