[Rt-commit] rt branch, 4.0/upgrade-syntax-fixes, updated. rt-4.0.0-240-gff1a6d9

? sunnavy sunnavy at bestpractical.com
Wed May 18 09:23:52 EDT 2011


The branch, 4.0/upgrade-syntax-fixes has been updated
       via  ff1a6d9c9d32b2cd5c502cc5a2df5be2a262ad72 (commit)
      from  e3ead5ce23321f8b0aa521232c7d83f473f761b6 (commit)

Summary of changes:
 etc/upgrade/3.9.7/content |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit ff1a6d9c9d32b2cd5c502cc5a2df5be2a262ad72
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed May 18 21:22:18 2011 +0800

    Revert "Pg needs the string => number cast too"
    
    another branch 4.0/upgrade-basedon-on-pg fixed this already.
    
    This reverts commit e3ead5ce23321f8b0aa521232c7d83f473f761b6.

diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index a62a9b4..f8073ed 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -4,24 +4,14 @@ my %number_column = (
 my $move_attributes = sub {
     my ($table, $type, $column) = @_;
     my $query;
-    if ( $number_column{$column} ) {
-        if ( RT->Config->Get('DatabaseType') eq 'Oracle' ) {
-            $query =
-"UPDATE $table SET $column = (SELECT TO_NUMBER(Content) FROM Attributes WHERE"
-              . " Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
-        }
-        elsif ( RT->Config->Get('DatabaseType') eq 'Pg' ) {
-            $query =
-"UPDATE $table SET $column = (SELECT TO_NUMBER(Content, '99999999999') FROM Attributes WHERE"
-              . " Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
-        }
+    if ( $number_column{ $column } && RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+        $query = "UPDATE $table SET $column = (SELECT TO_NUMBER(Content) FROM Attributes WHERE"
+            ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
+    } else {
+        $query = "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
+            ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
     }
 
-    $query ||=
-        "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
-      . " Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
-
-
     my $res = $RT::Handle->SimpleQuery( $query, $column, $type );
     unless ( $res ) {
         $RT::Logger->error("Failed to move $column on $type from Attributes into $table table");

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


More information about the Rt-commit mailing list