diff --git a/UPGRADE.md b/UPGRADE.md index cde5f747693..e1ba578c43d 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,17 @@ awareness about deprecated code. # Upgrade to 4.0 +## Abstract methods in the `AbstractSchemaManager` class have been declared as `abstract` + +The following abstract methods in the `AbstractSchemaManager` class have been declared as `abstract`: + +- `selectDatabaseColumns()`, +- `selectDatabaseIndexes()`, +- `selectDatabaseForeignKeys()`, +- `getDatabaseTableOptions()`. + +Every non-abstract schema manager class must implement them in order to satisfy the API. + # BC Break: The number of affected rows is returned as `int|string` The signatures of the methods returning the number of affected rows changed as returning `int|string` instead of `int`. diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php index 56518b03125..1b8deb2a3d1 100644 --- a/src/Schema/AbstractSchemaManager.php +++ b/src/Schema/AbstractSchemaManager.php @@ -219,23 +219,6 @@ protected function filterAssetNames(array $assetNames): array * @throws Exception */ public function listTables(): array - { - $tableNames = $this->listTableNames(); - - $tables = []; - foreach ($tableNames as $tableName) { - $tables[] = $this->listTableDetails($tableName); - } - - return $tables; - } - - /** - * @return list - * - * @throws Exception - */ - protected function doListTables(): array { $currentDatabase = $this->_conn->getDatabase(); @@ -282,23 +265,6 @@ protected function doListTables(): array * @throws Exception */ public function listTableDetails(string $name): Table - { - $columns = $this->listTableColumns($name); - $foreignKeys = []; - - if ($this->_platform->supportsForeignKeyConstraints()) { - $foreignKeys = $this->listTableForeignKeys($name); - } - - $indexes = $this->listTableIndexes($name); - - return new Table($name, $columns, $indexes, [], $foreignKeys, []); - } - - /** - * @throws Exception - */ - protected function doListTableDetails(string $name): Table { $currentDatabase = $this->_conn->getDatabase(); @@ -353,13 +319,8 @@ protected function normalizeName(string $name): string * the selection to this table. * * @throws Exception - * - * @abstract */ - protected function selectDatabaseColumns(string $databaseName, ?string $tableName = null): Result - { - throw NotSupported::new(__METHOD__); - } + abstract protected function selectDatabaseColumns(string $databaseName, ?string $tableName = null): Result; /** * Selects index definitions of the tables in the specified database. If the table name is specified, narrows down @@ -367,10 +328,7 @@ protected function selectDatabaseColumns(string $databaseName, ?string $tableNam * * @throws Exception */ - protected function selectDatabaseIndexes(string $databaseName, ?string $tableName = null): Result - { - throw NotSupported::new(__METHOD__); - } + abstract protected function selectDatabaseIndexes(string $databaseName, ?string $tableName = null): Result; /** * Selects foreign key definitions of the tables in the specified database. If the table name is specified, @@ -378,10 +336,7 @@ protected function selectDatabaseIndexes(string $databaseName, ?string $tableNam * * @throws Exception */ - protected function selectDatabaseForeignKeys(string $databaseName, ?string $tableName = null): Result - { - throw NotSupported::new(__METHOD__); - } + abstract protected function selectDatabaseForeignKeys(string $databaseName, ?string $tableName = null): Result; /** * Returns table options for the tables in the specified database. If the table name is specified, narrows down @@ -391,10 +346,7 @@ protected function selectDatabaseForeignKeys(string $databaseName, ?string $tabl * * @throws Exception */ - protected function getDatabaseTableOptions(string $databaseName, ?string $tableName = null): array - { - throw NotSupported::new(__METHOD__); - } + abstract protected function getDatabaseTableOptions(string $databaseName, ?string $tableName = null): array; /** * Lists the views this connection has. diff --git a/src/Schema/DB2SchemaManager.php b/src/Schema/DB2SchemaManager.php index 57a0816a1f0..e1ff7b3959a 100644 --- a/src/Schema/DB2SchemaManager.php +++ b/src/Schema/DB2SchemaManager.php @@ -43,19 +43,6 @@ public function listTableNames(): array return $this->filterAssetNames($this->_getPortableTablesList($tables)); } - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - /** * {@inheritdoc} * diff --git a/src/Schema/MySQLSchemaManager.php b/src/Schema/MySQLSchemaManager.php index 34564e55c94..ec29209e052 100644 --- a/src/Schema/MySQLSchemaManager.php +++ b/src/Schema/MySQLSchemaManager.php @@ -50,19 +50,6 @@ class MySQLSchemaManager extends AbstractSchemaManager "''" => "'", ]; - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - /** * {@inheritdoc} */ diff --git a/src/Schema/OracleSchemaManager.php b/src/Schema/OracleSchemaManager.php index b802818e2b0..42a000dc8d5 100644 --- a/src/Schema/OracleSchemaManager.php +++ b/src/Schema/OracleSchemaManager.php @@ -31,19 +31,6 @@ */ class OracleSchemaManager extends AbstractSchemaManager { - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - /** * {@inheritdoc} */ diff --git a/src/Schema/PostgreSQLSchemaManager.php b/src/Schema/PostgreSQLSchemaManager.php index 252a7ac5bd4..47410f1302f 100644 --- a/src/Schema/PostgreSQLSchemaManager.php +++ b/src/Schema/PostgreSQLSchemaManager.php @@ -36,19 +36,6 @@ class PostgreSQLSchemaManager extends AbstractSchemaManager { private ?string $currentSchema = null; - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - /** * {@inheritDoc} */ diff --git a/src/Schema/SQLServerSchemaManager.php b/src/Schema/SQLServerSchemaManager.php index 77eb340552a..0143bcc9bd4 100644 --- a/src/Schema/SQLServerSchemaManager.php +++ b/src/Schema/SQLServerSchemaManager.php @@ -34,19 +34,6 @@ class SQLServerSchemaManager extends AbstractSchemaManager { private ?string $databaseCollation = null; - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - /** * {@inheritDoc} */ diff --git a/src/Schema/SqliteSchemaManager.php b/src/Schema/SqliteSchemaManager.php index f13c6117e81..8734e0b0e05 100644 --- a/src/Schema/SqliteSchemaManager.php +++ b/src/Schema/SqliteSchemaManager.php @@ -41,19 +41,6 @@ */ class SqliteSchemaManager extends AbstractSchemaManager { - /** - * {@inheritDoc} - */ - public function listTables(): array - { - return $this->doListTables(); - } - - public function listTableDetails(string $name): Table - { - return $this->doListTableDetails($name); - } - public function renameTable(string $name, string $newName): void { $tableDiff = new TableDiff($name);