update TODO
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / Oracle.pm
index 7e0b33e..7c4ea38 100644 (file)
@@ -101,7 +101,7 @@ sub _table_uniq_info {
     $sth->execute($self->_uc($table),$self->{db_schema} );
     my %constr_names;
     while(my $constr = $sth->fetchrow_arrayref) {
-        my $constr_name = $constr->[0];
+        my $constr_name = $self->_lc($constr->[0]);
         my $constr_col  = $self->_lc($constr->[1]);
         $constr_name =~ s/\Q$self->{_quoter}\E//;
         $constr_col  =~ s/\Q$self->{_quoter}\E//;
@@ -163,9 +163,12 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK
             $info->{size} = $info->{size} / 2;
         }
         elsif (lc($info->{data_type}) eq 'number') {
-            $info->{data_type} = 'numeric';
+            $info->{original}{data_type} = 'number';
+            $info->{data_type}           = 'numeric';
 
             if (eval { $info->{size}[0] == 38 && $info->{size}[1] == 0 }) {
+                $info->{original}{size} = $info->{size};
+
                 $info->{data_type} = 'integer';
                 delete $info->{size};
             }
@@ -200,6 +203,18 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK
                 $info->{size} = [ $day_precision, $second_precision ];
             }
         }
+        elsif (lc($info->{data_type}) eq 'float') {
+            $info->{original}{data_type} = 'float';
+            $info->{original}{size}      = $info->{size};
+
+            if ($info->{size} <= 63) {
+                $info->{data_type} = 'real';
+            }
+            else {
+                $info->{data_type} = 'double precision';
+            }
+            delete $info->{size};
+        }
         elsif (lc($info->{data_type}) eq 'urowid' && $info->{size} == 4000) {
             delete $info->{size};
         }
@@ -207,12 +222,21 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK
             $info->{data_type}           = 'datetime';
             $info->{original}{data_type} = 'date';
         }
-
-        if (eval { lc(${ $info->{default_value} }) eq 'sysdate' }) {
-            $info->{original}{default_value} = $info->{default_value};
-
+        elsif (lc($info->{data_type}) eq 'binary_float') {
+            $info->{data_type}           = 'real';
+            $info->{original}{data_type} = 'binary_float';
+        } 
+        elsif (lc($info->{data_type}) eq 'binary_double') {
+            $info->{data_type}           = 'double precision';
+            $info->{original}{data_type} = 'binary_double';
+        } 
+
+        if ((eval { lc(${ $info->{default_value} }) }||'') eq 'sysdate') {
             my $current_timestamp  = 'current_timestamp';
             $info->{default_value} = \$current_timestamp;
+
+            my $sysdate = 'sysdate';
+            $info->{original}{default_value} = \$sysdate;
         }
     }