Skip to content

Commit fbb2c33

Browse files
committed
Remove deprecated schema introspection API
1 parent 87c3e58 commit fbb2c33

32 files changed

+114
-4024
lines changed

UPGRADE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ awareness about deprecated code.
88

99
# Upgrade to 5.0
1010

11+
## BC BREAK: Removed `AbstractSchemaManager` methods
12+
13+
The following `AbstractSchemaManager` methods have been removed:
14+
1. `listDatabases()`
15+
2. `listSchemaNames()`
16+
3. `listTableNames()`
17+
4. `listTableColumns()`
18+
5. `listTableIndexes()`
19+
6. `listTableForeignKeys()`
20+
7. `listTables()`
21+
8. `listViews()`
22+
9. `listSequences()`
23+
1124
## BC BREAK: changes in `Table` class
1225

1326
The `Table` class no longer accepts `foreignKeyConstraints`

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ parameters:
4747
paths:
4848
- src/Platforms/*MetadataProvider.php
4949
- src/Platforms/*Platform.php
50-
- src/Schema/*SchemaManager.php
5150

5251
# Some APIs use variable method calls internally
5352
-

src/Platforms/AbstractMySQLPlatform.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,6 @@ public function getLengthExpression(string $string): string
112112
return 'CHAR_LENGTH(' . $string . ')';
113113
}
114114

115-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
116-
public function getListDatabasesSQL(): string
117-
{
118-
return 'SHOW DATABASES';
119-
}
120-
121-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
122-
public function getListViewsSQL(string $database): string
123-
{
124-
return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $this->quoteStringLiteral($database);
125-
}
126-
127115
/**
128116
* {@inheritDoc}
129117
*/

src/Platforms/AbstractPlatform.php

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,25 +1786,6 @@ protected function _getTransactionIsolationLevelSQL(TransactionIsolationLevel $l
17861786
};
17871787
}
17881788

1789-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
1790-
public function getListDatabasesSQL(): string
1791-
{
1792-
throw NotSupported::new(__METHOD__);
1793-
}
1794-
1795-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
1796-
public function getListSequencesSQL(string $database): string
1797-
{
1798-
throw NotSupported::new(__METHOD__);
1799-
}
1800-
1801-
/**
1802-
* Returns the SQL to list all views of a database or user.
1803-
*
1804-
* @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy.
1805-
*/
1806-
abstract public function getListViewsSQL(string $database): string;
1807-
18081789
public function getCreateViewSQL(string $name, string $sql): string
18091790
{
18101791
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
@@ -2222,10 +2203,7 @@ public function getUnquotedIdentifierFolding(): UnquotedIdentifierFolding
22222203
*
22232204
* @throws Exception
22242205
*/
2225-
public function createMetadataProvider(Connection $connection): MetadataProvider
2226-
{
2227-
throw NotSupported::new(__METHOD__);
2228-
}
2206+
abstract public function createMetadataProvider(Connection $connection): MetadataProvider;
22292207

22302208
/**
22312209
* Creates the schema manager that can be used to inspect and change the underlying

src/Platforms/DB2Platform.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ public function getSetTransactionIsolationSQL(TransactionIsolationLevel $level):
204204
throw NotSupported::new(__METHOD__);
205205
}
206206

207-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
208-
public function getListViewsSQL(string $database): string
209-
{
210-
return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS';
211-
}
212-
213207
protected function getPrimaryKeyConstraintDeclarationSQL(PrimaryKeyConstraint $constraint): string
214208
{
215209
$this->ensurePrimaryKeyConstraintIsClustered($constraint);

src/Platforms/OraclePlatform.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,6 @@ public function getClobTypeDeclarationSQL(array $column): string
295295
return 'CLOB';
296296
}
297297

298-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
299-
public function getListDatabasesSQL(): string
300-
{
301-
return 'SELECT username FROM all_users';
302-
}
303-
304-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
305-
public function getListSequencesSQL(string $database): string
306-
{
307-
return 'SELECT SEQUENCE_NAME, MIN_VALUE, INCREMENT_BY FROM SYS.ALL_SEQUENCES WHERE SEQUENCE_OWNER = '
308-
. $this->quoteStringLiteral($database);
309-
}
310-
311298
/**
312299
* {@inheritDoc}
313300
*/
@@ -347,12 +334,6 @@ public function getCreateIndexSQL(Index $index, string $table): string
347334
return parent::getCreateIndexSQL($index, $table);
348335
}
349336

350-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
351-
public function getListViewsSQL(string $database): string
352-
{
353-
return 'SELECT view_name, text FROM sys.user_views';
354-
}
355-
356337
/** @return list<string> */
357338
private function getCreateAutoincrementSql(OptionallyQualifiedName $tableName, UnqualifiedName $columnName): array
358339
{

src/Platforms/PostgreSQLPlatform.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -141,35 +141,6 @@ protected function supportsCommentOnStatement(): bool
141141
return true;
142142
}
143143

144-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
145-
public function getListDatabasesSQL(): string
146-
{
147-
return 'SELECT datname FROM pg_database';
148-
}
149-
150-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
151-
public function getListSequencesSQL(string $database): string
152-
{
153-
return 'SELECT sequence_name,
154-
sequence_schema,
155-
minimum_value,
156-
increment
157-
FROM information_schema.sequences
158-
WHERE sequence_catalog = ' . $this->quoteStringLiteral($database) . "
159-
AND sequence_schema NOT LIKE 'pg\_%'
160-
AND sequence_schema != 'information_schema'";
161-
}
162-
163-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
164-
public function getListViewsSQL(string $database): string
165-
{
166-
return 'SELECT table_name,
167-
table_schema,
168-
view_definition
169-
FROM information_schema.views
170-
WHERE view_definition IS NOT NULL';
171-
}
172-
173144
protected function getPrimaryKeyConstraintDeclarationSQL(PrimaryKeyConstraint $constraint): string
174145
{
175146
$this->ensurePrimaryKeyConstraintIsClustered($constraint);

src/Platforms/SQLServerPlatform.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,6 @@ public function getCreateSequenceSQL(Sequence $sequence): string
150150
' MINVALUE ' . $sequence->getInitialValue();
151151
}
152152

153-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
154-
public function getListSequencesSQL(string $database): string
155-
{
156-
return 'SELECT seq.name,
157-
scm.name AS schema_name,
158-
CAST(
159-
seq.increment AS VARCHAR(MAX)
160-
) AS increment, -- CAST avoids driver error for sql_variant type
161-
CAST(
162-
seq.start_value AS VARCHAR(MAX)
163-
) AS start_value -- CAST avoids driver error for sql_variant type
164-
FROM sys.sequences AS seq
165-
JOIN sys.schemas AS scm
166-
ON scm.schema_id = seq.schema_id';
167-
}
168-
169153
public function getSequenceNextValSQL(string $sequence): string
170154
{
171155
return 'SELECT NEXT VALUE FOR ' . $sequence;
@@ -718,14 +702,6 @@ public function getEmptyIdentityInsertSQL(string $quotedTableName, string $quote
718702
return 'INSERT INTO ' . $quotedTableName . ' DEFAULT VALUES';
719703
}
720704

721-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
722-
public function getListViewsSQL(string $database): string
723-
{
724-
return "SELECT name, definition FROM sysobjects
725-
INNER JOIN sys.sql_modules ON sysobjects.id = sys.sql_modules.object_id
726-
WHERE type = 'V' ORDER BY name";
727-
}
728-
729705
public function getLocateExpression(string $string, string $substring, ?string $start = null): string
730706
{
731707
if ($start === null) {
@@ -774,12 +750,6 @@ public function getConcatExpression(string ...$string): string
774750
return sprintf('CONCAT(%s)', implode(', ', $string));
775751
}
776752

777-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
778-
public function getListDatabasesSQL(): string
779-
{
780-
return 'SELECT * FROM sys.databases';
781-
}
782-
783753
public function getSubstringExpression(string $string, string $start, ?string $length = null): string
784754
{
785755
if ($length === null) {

src/Platforms/SQLitePlatform.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,6 @@ public function getClobTypeDeclarationSQL(array $column): string
376376
return 'CLOB';
377377
}
378378

379-
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
380-
public function getListViewsSQL(string $database): string
381-
{
382-
return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL";
383-
}
384-
385379
protected function getPrimaryKeyConstraintDeclarationSQL(PrimaryKeyConstraint $constraint): string
386380
{
387381
$this->ensurePrimaryKeyConstraintIsNotNamed($constraint);

0 commit comments

Comments
 (0)