[freeside-commits] freeside/FS/FS Schema.pm,1.168.2.25,1.168.2.26

Ivan,,, ivan at wavetail.420.am
Thu Mar 25 22:02:54 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv23726/FS/FS

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Schema.pm 
Log Message:
kludge a fix for the MySQL statustext index problem, fix s/serial/int/ for non-primary keys in part_pkg_taxoverride, and s/TEXT/LONGTEXT/ ourselves until DBIx::DBSchema 0.39

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.168.2.25
retrieving revision 1.168.2.26
diff -u -w -d -r1.168.2.25 -r1.168.2.26
--- Schema.pm	26 Mar 2010 02:28:06 -0000	1.168.2.25
+++ Schema.pm	26 Mar 2010 05:02:52 -0000	1.168.2.26
@@ -102,6 +102,10 @@
       my %hash = map { $_ => shift @coldef }
                      qw( name type null length default local );
 
+      #can be removed once we depend on DBIx::DBSchema 0.39;
+      $hash{'type'} = 'LONGTEXT'
+        if $hash{'type'} =~ /^TEXT$/i && $datasrc =~ /^dbi:mysql/i;
+
       unless ( defined $hash{'default'} ) {
         warn "$tablename:\n".
              join('', map "$_ => $hash{$_}\n", keys %hash) ;# $stop = <STDIN>;
@@ -113,7 +117,17 @@
     #false laziness w/sub indices in DBIx::DBSchema::DBD (well, sorta)
     #and sub sql_create_table in DBIx::DBSchema::Table (slighty more?)
     my $unique = $tables_hashref->{$tablename}{'unique'};
-    my $index  = $tables_hashref->{$tablename}{'index'};
+    my @index  = @{ $tables_hashref->{$tablename}{'index'} };
+
+    # kludge to avoid avoid "BLOB/TEXT column 'statustext' used in key
+    #  specification without a key length".
+    # better solution: teach DBIx::DBSchema to specify a default length for
+    #  MySQL indices on text columns, or just to support an index length at all
+    #  so we can pass something in.
+    # best solution: eliminate need for this index in cust_main::retry_realtime
+    @index = grep { @{$_}[0] ne 'statustext' } @index
+      if $datasrc =~ /^dbi:mysql/i;
+
     my @indices = ();
     push @indices, map {
                          DBIx::DBSchema::Index->new({
@@ -130,7 +144,7 @@
                            'columns' => $_,
                          });
                        }
-                       @$index;
+                       @index;
 
     DBIx::DBSchema::Table->new({
       'name'          => $tablename,
@@ -1353,8 +1367,8 @@
     'part_pkg_taxoverride' => { 
       'columns' => [
         'taxoverridenum', 'serial', '', '', '', '',
-        'pkgpart',        'serial', '', '', '', '',
-        'taxclassnum',    'serial', '', '', '', '',
+        'pkgpart',           'int', '', '', '', '',
+        'taxclassnum',       'int', '', '', '', '',
         'usage_class',    'varchar', 'NULL', $char_d, '', '', 
       ],
       'primary_key' => 'taxoverridenum',



More information about the freeside-commits mailing list