コード例 #1
0
ファイル: MigrationManager.php プロジェクト: sam25/website
 /**
  * Used to create the alter table query that will be used to repair a given table
  *
  * @param string $table The table to be altered
  * @param array $toAdd The columns that need to be added to $table
  * @param array $keys The keys associated with the columns to be added (if any)
  */
 private function alterTable($table, $toAdd, $keys)
 {
     // Create a new alter table query
     $alter = new AlterTable();
     // Set the table to alter to $table
     $alter->Table($table);
     // Add each field to the alter table query
     for ($i = 0; $i < count($toAdd); $i++) {
         $alter->AddField($toAdd[$i]);
     }
     // Add the keys if needed
     $this->addKeys($alter, $keys);
     // Execute the alter query
     DatabaseManager::Query($alter);
 }