コード例 #1
0
 /**
  * Checks if this sequence is an autoincrement sequence for a given table.
  *
  * This is used inside the comparator to not report sequences as missing,
  * when the "from" schema implicitly creates the sequences.
  *
  * @param \Doctrine\DBAL\Schema\Table $table
  *
  * @return boolean
  */
 public function isAutoIncrementsFor(Table $table)
 {
     if (!$table->hasPrimaryKey()) {
         return false;
     }
     $pkColumns = $table->getPrimaryKey()->getColumns();
     if (count($pkColumns) != 1) {
         return false;
     }
     $column = $table->getColumn($pkColumns[0]);
     if (!$column->getAutoincrement()) {
         return false;
     }
     $sequenceName = $this->getShortestName($table->getNamespaceName());
     $tableName = $table->getShortestName($table->getNamespaceName());
     $tableSequenceName = sprintf('%s_%s_seq', $tableName, $pkColumns[0]);
     return $tableSequenceName === $sequenceName;
 }