Example #1
0
 public final function migrateTable()
 {
     // Test if table exists
     if (Connection::tableExists($this->table->getName())) {
         $current = Connection::getTable($this->table->getName());
         $alter = Table::computeAlter($current, $this->table);
         if ($alter) {
             echo "Migrating table " . $this->table->getName() . "\n";
             Connection::query($alter);
         }
     } else {
         // create table
         echo "Creating table " . $this->table->getName() . "\n";
         Connection::query($this->table->getCreateSql());
     }
 }