Development

Changeset 9474

You must first sign up to be able to contribute.

Changeset 9474

Show
Ignore:
Timestamp:
06/09/08 10:01:10 (2 years ago)
Author:
FabianLange
Message:

1.0: added support for specifying index size like my_index: [created_at(10)] to support putting indexes and uniques on mysql text type columns. (backport from r9457)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/addon/propel/sfPropelDatabaseSchema.class.php

    r7900 r9474  
    7373          foreach ($index as $index_column) 
    7474          { 
    75             $xml .= "      <index-column name=\"$index_column\" />\n"; 
     75            preg_match('/^(.+?)\(([\d]+)\)$/', $index_column, $matches); 
     76            if (isset($matches[2])) 
     77            { 
     78              $xml .= "      <index-column name=\"{$matches[1]}\" size=\"{$matches[2]}\" />\n"; 
     79            } 
     80            else 
     81            { 
     82              $xml .= "      <index-column name=\"$index_column\" />\n"; 
     83            } 
    7684          } 
    7785          $xml .= "    </index>\n"; 
     
    8795          foreach ($index as $unique_column) 
    8896          { 
    89             $xml .= "      <unique-column name=\"$unique_column\" />\n"; 
     97            preg_match('/^(.+?)\(([\d]+)\)$/', $unique_column, $matches); 
     98            if (isset($matches[2])) 
     99            { 
     100              $xml .= "      <unique-column name=\"{$matches[1]}\" size=\"{$matches[2]}\" />\n"; 
     101            } 
     102            else 
     103            { 
     104              $xml .= "      <unique-column name=\"$unique_column\" />\n"; 
     105            } 
    90106          } 
    91107          $xml .= "    </unique>\n"; 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.