Three pre-existing gaps that the driver suite added in #1422 ran into. None of them are regressions, and none are related to the schema-drift work — they are skipped there through capability predicates in test/data/typeorm/integration.ts, so each fix comes with a predicate to widen and the assertions turn on by themselves.
Filing them together because they were all found in one pass; happy to split.
1. checkDatabase throws on cockroachdb instead of reporting exists: false
checkDatabase derives exists from DataSource.initialize() failing:
// src/database/methods/check/module.ts
try {
if (!dataSource.isInitialized) {
await dataSource.initialize();
}
} catch {
result.exists = false;
return result;
}
CockroachDB accepts a connection to a database which does not exist — the error only surfaces on the first query, so the schema probe a few lines further down throws instead:
QueryFailedError: database "typeorm_extension_integration" does not exist
at CockroachQueryRunner.hasTable
at checkDatabase (src/database/methods/check/module.ts:94)
A caller using checkDatabase to decide whether to create the database gets an exception rather than { exists: false }.
Reproduce: dropDatabase(...), then checkDatabase({ options }) against cockroachdb.
2. checkDatabase throws on mongodb
Same entry point, different cause — the mongo query runner does not implement the schema probe at all:
TypeORMError: Check schema queries are not supported by MongoDB driver.
Needs a decision on what schema: true should even mean for mongodb (collections are created lazily; MongoSchemaBuilder.build() only creates indices), which is why it is a gap rather than an oversight.
3. oracle createDatabase emits invalid SQL, dropDatabase is a no-op
// src/database/core/oracle/statements.ts
export function buildOracleCreateDatabaseQuery(database: string): string {
return `CREATE DATABASE IF NOT EXISTS ${database}`;
}
IF NOT EXISTS is not valid Oracle SQL — the existing code comment already flags this and preserves the statement byte-for-byte from the pre-refactor implementation, since changing it is a semantic decision rather than a refactor side effect. OracleDialect.drop() is a documented Promise.resolve().
Oracle also has no CREATE DATABASE in the sense the other drivers use it: what a consumer wants here is almost certainly a user/schema (CREATE USER … / DROP USER … CASCADE), which makes this an API-shape question, not just a broken statement.
Note on coverage
src/database/adapters/** is excluded from the coverage gate, so none of this was visible before the driver suite existed. The suite now runs against postgres, cockroachdb, mysql, mariadb, mssql, mongodb and oracle in CI, which is where a fix for any of the above gets verified.
Three pre-existing gaps that the driver suite added in #1422 ran into. None of them are regressions, and none are related to the schema-drift work — they are skipped there through capability predicates in
test/data/typeorm/integration.ts, so each fix comes with a predicate to widen and the assertions turn on by themselves.Filing them together because they were all found in one pass; happy to split.
1.
checkDatabasethrows on cockroachdb instead of reportingexists: falsecheckDatabasederivesexistsfromDataSource.initialize()failing:CockroachDB accepts a connection to a database which does not exist — the error only surfaces on the first query, so the schema probe a few lines further down throws instead:
A caller using
checkDatabaseto decide whether to create the database gets an exception rather than{ exists: false }.Reproduce:
dropDatabase(...), thencheckDatabase({ options })against cockroachdb.supportsDatabaseExistenceCheckintest/data/typeorm/integration.ts2.
checkDatabasethrows on mongodbSame entry point, different cause — the mongo query runner does not implement the schema probe at all:
Needs a decision on what
schema: trueshould even mean for mongodb (collections are created lazily;MongoSchemaBuilder.build()only creates indices), which is why it is a gap rather than an oversight.supportsSchemaMetadata/supportsDatabaseExistenceCheck3. oracle
createDatabaseemits invalid SQL,dropDatabaseis a no-opIF NOT EXISTSis not valid Oracle SQL — the existing code comment already flags this and preserves the statement byte-for-byte from the pre-refactor implementation, since changing it is a semantic decision rather than a refactor side effect.OracleDialect.drop()is a documentedPromise.resolve().Oracle also has no
CREATE DATABASEin the sense the other drivers use it: what a consumer wants here is almost certainly a user/schema (CREATE USER … / DROP USER … CASCADE), which makes this an API-shape question, not just a broken statement.supportsDatabaseDropNote on coverage
src/database/adapters/**is excluded from the coverage gate, so none of this was visible before the driver suite existed. The suite now runs against postgres, cockroachdb, mysql, mariadb, mssql, mongodb and oracle in CI, which is where a fix for any of the above gets verified.