Example #1
0
 public function testAddOption()
 {
     $instance = new Table('Foo');
     $instance->addOption('bar', array('foobar'));
     $expected = array('bar' => array('foobar'));
     $this->assertEquals($expected, $instance->getConfiguration());
 }
 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function create(Table $table)
 {
     $configuration = $table->getConfiguration();
     $tableName = $table->getName();
     $this->reportMessage("Checking table {$tableName} ...\n");
     if ($this->connection->tableExists($tableName) === false) {
         // create new table
         $this->reportMessage("   Table not found, now creating...\n");
         $this->doCreateTable($tableName, $configuration);
     } else {
         $this->reportMessage("   Table already exists, checking structure ...\n");
         $this->doUpdateTable($tableName, $configuration);
     }
     $this->reportMessage("   ... done.\n");
     if (!isset($configuration['indicies'])) {
         return $this->reportMessage("No index structures for table {$tableName} ...\n");
     }
     $this->reportMessage("Checking index structures for table {$tableName} ...\n");
     $this->doCreateIndicies($tableName, $configuration);
     $this->reportMessage("   ... done.\n");
 }