/** * 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; }
/** * @param \Doctrine\DBAL\Schema\Table $table * * @return void * * @throws \Doctrine\DBAL\Schema\SchemaException */ protected function _addTable(Table $table) { $namespaceName = $table->getNamespaceName(); $tableName = $table->getFullQualifiedName($this->getName()); if (isset($this->_tables[$tableName])) { throw SchemaException::tableAlreadyExists($tableName); } if (!$table->isInDefaultNamespace($this->getName()) && !$this->hasNamespace($namespaceName)) { $this->createNamespace($namespaceName); } $this->_tables[$tableName] = $table; $table->setSchemaConfig($this->_schemaConfig); }