[Rt-commit] rt branch, 4.2/deprecate-type-column-in-groups, created. rt-4.1.8-480-gd9a9b1e

Alex Vandiver alexmv at bestpractical.com
Fri May 24 17:42:30 EDT 2013


The branch, 4.2/deprecate-type-column-in-groups has been created
        at  d9a9b1e0d13e16947d2be9322c9c891e3e9605ba (commit)

- Log -----------------------------------------------------------------
commit d9a9b1e0d13e16947d2be9322c9c891e3e9605ba
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri May 17 18:49:13 2013 +0400

    we have to set Name = Type earlier for upgrade
    
    If we don't new code may fail during upgrade

diff --git a/etc/upgrade/4.1.13/backcompat b/etc/upgrade/4.1.13/backcompat
new file mode 100644
index 0000000..b4e69a3
--- /dev/null
+++ b/etc/upgrade/4.1.13/backcompat
@@ -0,0 +1,31 @@
+my $upgrade = shift;
+
+my $groups = RT::Groups->new( RT->SystemUser );
+$groups->Limit(
+    FIELD => 'Name', OPERATOR => '!=', VALUE => 'main.Type', QUOTEVALUE => 0
+);
+$groups->Limit(
+    FIELD => 'Domain',
+    VALUE => 'SystemInternal',
+    CASESENSITIVE => 0,
+);
+$groups->RowsPerPage(1);
+if ( $groups->Next ) {
+    my $dbh = $RT::Handle->dbh;
+    my $db_type = RT->Config->Get('DatabaseType');
+    if ( $db_type eq 'Oracle' || $db_type eq 'Pg' ) {
+        $dbh->do(
+            "UPDATE Groups SET Name = Type
+            WHERE LOWER(Domain) IN ('aclequivalence', 'systeminternal')
+                OR LOWER(Domain) LIKE '%-role'"
+        );
+    } else {
+        $dbh->do(
+            "UPDATE Groups SET Name = Type
+            WHERE Domain IN ('ACLEquivalence', 'SystemInternal')
+                OR Domain LIKE '%-Role'"
+        );
+    }
+}
+
+$upgrade->();

-----------------------------------------------------------------------


More information about the Rt-commit mailing list