예제 #1
0
 public function testResetColumnsSize()
 {
     $columns[] = $this->getColumnMock('foo', array('size' => 100));
     $columns[] = $this->getColumnMock('bar', array('size' => 5));
     $index = new Index();
     $index->setColumns($columns);
     $this->assertTrue($index->hasColumnSize('foo'));
     $this->assertTrue($index->hasColumnSize('bar'));
     $index->resetColumnsSize();
     $this->assertFalse($index->hasColumnSize('foo'));
     $this->assertFalse($index->hasColumnSize('bar'));
 }
 /**
  * Creates a comma-separated list of column names for the index.
  * For MySQL unique indexes there is the option of specifying size, so we cannot simply use
  * the getColumnsList() method.
  * @param  Index  $index
  * @return string
  */
 protected function getIndexColumnListDDL(Index $index)
 {
     $list = array();
     foreach ($index->getColumns() as $col) {
         $list[] = $this->quoteIdentifier($col) . ($index->hasColumnSize($col) ? '(' . $index->getColumnSize($col) . ')' : '');
     }
     return implode(', ', $list);
 }