[Rt-commit] rt branch, 4.0/upgrade-basedon-on-pg, created. rt-4.0.0-170-g506d072
Ruslan Zakirov
ruz at bestpractical.com
Fri Apr 29 12:42:57 EDT 2011
The branch, 4.0/upgrade-basedon-on-pg has been created
at 506d072c43b8be0ab52ddc852200d21909070eec (commit)
- Log -----------------------------------------------------------------
commit 506d072c43b8be0ab52ddc852200d21909070eec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Apr 29 20:41:43 2011 +0400
on Pg we have to use explicit casting
diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index f8073ed..8431857 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -3,10 +3,14 @@ my %number_column = (
);
my $move_attributes = sub {
my ($table, $type, $column) = @_;
+ my $db_type = RT->Config->Get('DatabaseType');
my $query;
- if ( $number_column{ $column } && RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+ if ( $number_column{ $column } && $db_type eq 'Oracle' ) {
$query = "UPDATE $table SET $column = (SELECT TO_NUMBER(Content) FROM Attributes WHERE"
." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
+ } elsif ( $number_column{ $column } && $db_type eq 'Pg' ) {
+ $query = "UPDATE $table SET $column = (SELECT CAST(Content AS INTEGER) 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)";
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list