diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index e6dbbab27..945807b5b 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -155,7 +155,7 @@ abstract class AbstractSchemaManager /** * List the available sequences for this connection * - * @return array $sequences + * @return Sequence[] */ public function listSequences($database = null) { @@ -169,39 +169,9 @@ abstract class AbstractSchemaManager return $this->_getPortableSequencesList($sequences); } - /** - * List the constraints for a given table - * - * @param string $table The name of the table - * @return array $tableConstraints - */ - public function listTableConstraints($table) - { - $sql = $this->_platform->getListTableConstraintsSql($table); - - $tableConstraints = $this->_conn->fetchAll($sql); - - return $this->_getPortableTableConstraintsList($tableConstraints); - } - /** * List the columns for a given table. * - * @example array( - * 'colA' => array( - * 'name' => 'colA', - * 'type' => \Doctrine\DBAL\Types\StringType instance, - * 'length' => 255, - * 'precision' => null, - * 'scale' => null, - * 'unsigned' => false, - * 'fixed' => false, - * 'notnull' => false, - * 'default' => null, - * 'platformDetails' => array(), - * ), - * ); - * * In contrast to other libraries and to the old version of Doctrine, * this column definition does try to contain the 'primary' field for * the reason that it is not portable accross different RDBMS. Use @@ -210,7 +180,7 @@ abstract class AbstractSchemaManager * in the platformDetails array. * * @param string $table The name of the table. - * @return array $tableColumns The column descriptions. + * @return Column[] */ public function listTableColumns($table) { @@ -263,20 +233,6 @@ abstract class AbstractSchemaManager $tables = array(); foreach ($tableNames AS $tableName) { - $columns = $this->listTableColumns($tableName); - $foreignKeys = array(); - if ($this->_platform->supportsForeignKeyConstraints()) { - $foreignKeys = $this->listTableForeignKeys($tableName); - } - $indexes = $this->listTableIndexes($tableName); - - $idGeneratorType = Table::ID_NONE; - foreach ($columns AS $column) { - if ($column->hasPlatformOption('autoincrement') && $column->getPlatformOption('autoincrement')) { - $idGeneratorType = Table::ID_IDENTITY; - } - } - $tables[] = $this->listTableDetails($tableName); } @@ -633,81 +589,6 @@ abstract class AbstractSchemaManager $this->alterTable($tableDiff); } - /** - * Add a new table column - * - * @param string $name The name of the table - * @param string $column The name of the column to add - * @param array $definition The definition of the column to add - */ - public function addTableColumn($name, $column, $definition) - { - $change = array( - 'add' => array( - $column => $definition - ) - ); - $this->alterTable($name, $change); - } - - /** - * Remove a column from a table - * - * @param string $tableName The name of the table - * @param array|string $column The column name or array of names - */ - public function removeTableColumn($name, $column) - { - $change = array( - 'remove' => is_array($column) ? $column : array($column => array()) - ); - $this->alterTable($name, $change); - } - - /** - * Change a given table column. You can change the type, length, etc. - * - * @param string $name The name of the table - * @param string $type The type of the column - * @param string $length The length of the column - * @param string $definition The definition array for the column - */ - public function changeTableColumn($name, $type, $length = null, $definition = array()) - { - $definition['type'] = $type; - - $change = array( - 'change' => array( - $name => array( - 'length' => $length, - 'definition' => $definition - ) - ) - ); - $this->alterTable($name, $change); - } - - /** - * Rename a given table column - * - * @param string $name The name of the table - * @param string $oldName The old column name - * @param string $newName The new column - * @param string $definition The column definition array if you want to change something - */ - public function renameTableColumn($name, $oldName, $newName, $definition = array()) - { - $change = array( - 'rename' => array( - $oldName => array( - 'name' => $newName, - 'definition' => $definition - ) - ) - ); - $this->alterTable($name, $change); - } - /** * Methods for filtering return values of list*() methods to convert * the native DBMS data definition to a portable Doctrine definition @@ -781,22 +662,6 @@ abstract class AbstractSchemaManager throw DBALException::notSupported('Sequences'); } - protected function _getPortableTableConstraintsList($tableConstraints) - { - $list = array(); - foreach ($tableConstraints as $key => $value) { - if ($value = $this->_getPortableTableConstraintDefinition($value)) { - $list[] = $value; - } - } - return $list; - } - - protected function _getPortableTableConstraintDefinition($tableConstraint) - { - return $tableConstraint; - } - /** * Independent of the database the keys of the column list result are lowercased. * diff --git a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php index ac60c0c1d..2b1ed9944 100644 --- a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php @@ -70,18 +70,6 @@ class MySqlSchemaManager extends AbstractSchemaManager return parent::_getPortableTableIndexesList($tableIndexes, $tableName); } - protected function _getPortableTableConstraintDefinition($tableConstraint) - { - $tableConstraint = array_change_key_case($tableConstraint, CASE_LOWER); - - if ( ! $tableConstraint['non_unique']) { - $index = $tableConstraint['key_name']; - if ( ! empty($index)) { - return $index; - } - } - } - protected function _getPortableSequenceDefinition($sequence) { return end($sequence); diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index 7c70ea938..46a2a3265 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -233,12 +233,6 @@ class OracleSchemaManager extends AbstractSchemaManager return new Sequence($sequence['sequence_name'], $sequence['increment_by'], $sequence['min_value']); } - protected function _getPortableTableConstraintDefinition($tableConstraint) - { - $tableConstraint = \array_change_key_case($tableConstraint, CASE_LOWER); - return $tableConstraint['constraint_name']; - } - protected function _getPortableFunctionDefinition($function) { $function = \array_change_key_case($function, CASE_LOWER); diff --git a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php index 1570ee20b..8e1bbd8b7 100644 --- a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php @@ -162,11 +162,6 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager return new Sequence($sequence['relname'], $data[0]['increment_by'], $data[0]['min_value']); } - protected function _getPortableTableConstraintDefinition($tableConstraint) - { - return $tableConstraint['relname']; - } - protected function _getPortableTableColumnDefinition($tableColumn) { $tableColumn = array_change_key_case($tableColumn, CASE_LOWER); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index eba82a724..cd6a50b2a 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -8,13 +8,6 @@ require_once __DIR__ . '/../../../TestInit.php'; class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase { - public function testListTableConstraints() - { - $this->createTestTable('list_table_constraints_test'); - $tableConstraints = $this->_sm->listTableConstraints('list_table_constraints_test'); - $this->assertEquals(array('PRIMARY'), $tableConstraints); - } - public function testListUsers() { $users = $this->_sm->listUsers(); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php index c478adc41..1858e33cb 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php @@ -32,13 +32,6 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase $this->_sm->listTriggers(); } - public function testListTableConstraints() - { - $this->createTestTable('test_constraints'); - $tableConstraints = $this->_sm->listTableConstraints('test_constraints'); - $this->assertTrue(count($tableConstraints)>=2); - } - public function testListUsers() { $users = $this->_sm->listUsers(); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php index be50bed4e..ce0c10d9b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php @@ -8,13 +8,6 @@ require_once __DIR__ . '/../../../TestInit.php'; class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase { - public function testListTableConstraints() - { - $this->createTestTable('list_table_constraints_test'); - $tableConstraints = $this->_sm->listTableConstraints('list_table_constraints_test'); - $this->assertEquals(array('list_table_constraints_test_pkey'), $tableConstraints); - } - public function testListUsers() { $users = $this->_sm->listUsers(); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index 0285f5966..df84282c4 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -36,15 +36,6 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase $this->_sm->listTriggers(); } - public function testListTableConstraints() - { - // TODO: Implement support for constraints/foreign keys to be specified - // when creating tables. Sqlite does not support adding them after - // the table has already been created - $tableConstraints = $this->_sm->listTableConstraints('list_table_constraints_test'); - $this->assertEquals(array(), $tableConstraints); - } - /** * @expectedException \Exception */