[Rt-commit] rt branch, 4.2/set-articles-seq-nextval, created. rt-4.2.10-223-g91d6068

Todd Wade todd at bestpractical.com
Thu Mar 26 18:42:53 EDT 2015


The branch, 4.2/set-articles-seq-nextval has been created
        at  91d606843d6a8957e2840f8dd54d4b534a668c36 (commit)

- Log -----------------------------------------------------------------
commit 91d606843d6a8957e2840f8dd54d4b534a668c36
Author: Todd Wade <todd at bestpractical.com>
Date:   Thu Mar 26 18:38:38 2015 -0400

    properly migrate PostgreSQL sequence objects
    https://issues.bestpractical.com/Ticket/Display.html?id=18248
    
    set the sequence value so that RT doesn't try to give new articles an id of 1

diff --git a/etc/upgrade/upgrade-articles.in b/etc/upgrade/upgrade-articles.in
index 742fd17..67d3e5e 100644
--- a/etc/upgrade/upgrade-articles.in
+++ b/etc/upgrade/upgrade-articles.in
@@ -259,3 +259,11 @@ sub copy_tables {
         warn "Updating Attribute ".$a->Name." to point to RT::Class";
     }
 }
+
+{ # update Postgres sequence
+    if ( $db_type eq 'Pg' ) {
+        my $sql = "SELECT SETVAL('articles_id_seq', MAX(id) ) FROM articles";
+        $RT::Logger->debug($sql);
+        $dbh->do($sql);
+    }
+}

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


More information about the rt-commit mailing list