diff --git a/ormconfig.gh-actions.json b/ormconfig.gh-actions.json index 325a4850a..b7c75f9e7 100644 --- a/ormconfig.gh-actions.json +++ b/ormconfig.gh-actions.json @@ -1,13 +1,13 @@ [ { - "skip": false, + "skip": true, "name": "sqlite", "type": "sqlite", "database": "temp/sqlite.db", "logging": false }, { - "skip": true, + "skip": false, "name": "postgres", "type": "postgres", "host": "localhost", @@ -18,7 +18,7 @@ "logging": false }, { - "skip": false, + "skip": true, "name": "mysql", "type": "mysql", "host": "127.0.0.1", diff --git a/src/driver/postgres/PostgresQueryRunner.ts b/src/driver/postgres/PostgresQueryRunner.ts index 0f91081b5..90c2d85a6 100644 --- a/src/driver/postgres/PostgresQueryRunner.ts +++ b/src/driver/postgres/PostgresQueryRunner.ts @@ -24,7 +24,6 @@ import {IsolationLevel} from "../types/IsolationLevel.ts"; import {PostgresDriver} from "./PostgresDriver.ts"; import {PoolClient, QueryArrayResult} from "./typings.ts"; import {NotImplementedError} from "../../error/NotImplementedError.ts"; -import {PromiseQueue} from "../../util/PromiseQueue.ts"; /** * Runs queries on a single postgres database connection. @@ -156,24 +155,6 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner this.isTransactionActive = false; } - private queryQueueMap = new Map>(); - - /** - * TODO Remove this method. - * This method is a workaround for a concurrency problem that occurs sometimes when using deno-postgres@v0.3.6. - */ - private executeQuery(connection: PoolClient, query: string, parameters: any[]) { - if (!this.queryQueueMap.has(connection)) { - const queue = new PromiseQueue(); - this.queryQueueMap.set(connection, queue); - queue.onEmpty().then(() => { - this.queryQueueMap.delete(connection); - }); - } - const queue = this.queryQueueMap.get(connection); - return queue!.add(() => connection.queryArray(query, ...parameters)); - } - /** * Executes a given SQL query. */ @@ -191,8 +172,7 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner let error: any | undefined; let result: QueryArrayResult | undefined; try { - //result = await databaseConnection.query(query, ...(parameters || [])); - result = await this.executeQuery(databaseConnection, query, parameters || []); + result = await databaseConnection.queryArray(query, ...(parameters || [])); } catch (err) { error = err; } diff --git a/test/functional/schema-builder/change-column.ts b/test/functional/schema-builder/change-column.ts index 28d1aabad..a2e4915b5 100644 --- a/test/functional/schema-builder/change-column.ts +++ b/test/functional/schema-builder/change-column.ts @@ -6,8 +6,7 @@ import {AuroraDataApiDriver} from "../../../src/driver/aurora-data-api/AuroraDat // import {CockroachDriver} from "../../../src/driver/cockroachdb/CockroachDriver.ts"; import {MysqlDriver} from "../../../src/driver/mysql/MysqlDriver.ts"; import {OracleDriver} from "../../../src/driver/oracle/OracleDriver.ts"; -// TODO(uki00a) uncomment this when PostgresDriver is implemented. -// import {PostgresDriver} from "../../../src/driver/postgres/PostgresDriver.ts"; +import {PostgresDriver} from "../../../src/driver/postgres/PostgresDriver.ts"; import {SapDriver} from "../../../src/driver/sap/SapDriver.ts"; import {AbstractSqliteDriver} from "../../../src/driver/sqlite-abstract/AbstractSqliteDriver.ts"; import {SqlServerDriver} from "../../../src/driver/sqlserver/SqlServerDriver.ts"; @@ -169,7 +168,7 @@ describe("schema builder > change column", () => { const queryRunner = connection.createQueryRunner(); - if (false/*connection.driver instanceof PostgresDriver*/) // TODO(uki00a) uncomment this when PostgresDriver is implemented. + if (connection.driver instanceof PostgresDriver) await queryRunner.query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`); const postMetadata = connection.getMetadata(Post); @@ -178,9 +177,7 @@ describe("schema builder > change column", () => { idColumn.generationStrategy = "uuid"; // depending on driver, we must change column and referenced column types - if (false/*connection.driver instanceof PostgresDriver || connection.driver instanceof CockroachDriver*/) { - // TODO(uki00a) uncomment this when PostgresDriver is implemented. - // TODO(uki00a) uncomment this when CockroachDriver is implemented. + if (connection.driver instanceof PostgresDriver/* || connection.driver instanceof CockroachDriver*/) { // TODO(uki00a) uncomment this when CockroachDriver is implemented. idColumn.type = "uuid"; } else if (connection.driver instanceof SqlServerDriver) { idColumn.type = "uniqueidentifier"; @@ -193,9 +190,7 @@ describe("schema builder > change column", () => { const postTable = await queryRunner.getTable("post"); await queryRunner.release(); - if (/*connection.driver instanceof PostgresDriver || */connection.driver instanceof SqlServerDriver/* || connection.driver instanceof CockroachDriver*/) { - // TODO(uki00a) uncomment this when PostgresDriver is implemented. - // TODO(uki00a) uncomment this when CockroachDriver is implemented. + if (connection.driver instanceof PostgresDriver || connection.driver instanceof SqlServerDriver/* || connection.driver instanceof CockroachDriver*/) { // TODO(uki00a) uncomment this when CockroachDriver is implemented. postTable!.findColumnByName("id")!.isGenerated.should.be.true; postTable!.findColumnByName("id")!.generationStrategy!.should.be.equal("uuid"); @@ -226,9 +221,7 @@ describe("schema builder > change column", () => { idColumn.generationStrategy = "uuid"; // depending on driver, we must change column and referenced column types - if (false/*connection.driver instanceof PostgresDriver || connection.driver instanceof CockroachDriver*/) { - // TODO(uki00a) uncomment this when PostgresDriver is implemented. - // TODO(uki00a) uncomment this when CockroachDriver is implemented. + if (connection.driver instanceof PostgresDriver/* || connection.driver instanceof CockroachDriver*/) { // TODO(uki00a) uncomment this when CockroachDriver is implemented. idColumn.type = "uuid"; teacherColumn.type = "uuid"; } else if (connection.driver instanceof SqlServerDriver) { @@ -245,7 +238,7 @@ describe("schema builder > change column", () => { const teacherTable = await queryRunner.getTable("teacher"); await queryRunner.release(); - if (/*connection.driver instanceof PostgresDriver || */connection.driver instanceof SqlServerDriver) { // TODO(uki00a) uncomment this when PostgresDriver is implemented. + if (connection.driver instanceof PostgresDriver || connection.driver instanceof SqlServerDriver) { teacherTable!.findColumnByName("id")!.isGenerated.should.be.true; teacherTable!.findColumnByName("id")!.generationStrategy!.should.be.equal("uuid"); diff --git a/test/github-issues/2067/issue-2067.ts b/test/github-issues/2067/issue-2067.ts index f38caf2e0..f7f41c3cc 100644 --- a/test/github-issues/2067/issue-2067.ts +++ b/test/github-issues/2067/issue-2067.ts @@ -2,7 +2,7 @@ import {runIfMain} from "../../deps/mocha.ts"; import {expect} from "../../deps/chai.ts"; import {createTestingConnections, closeTestingConnections, reloadTestingDatabases} from "../../utils/test-utils.ts"; import {Connection} from "../../../src/connection/Connection.ts"; -//import {PostgresDriver} from "../../../src/driver/postgres/PostgresDriver.ts"; +import {PostgresDriver} from "../../../src/driver/postgres/PostgresDriver.ts"; import {User} from "./entity/User.ts"; describe("github issues > #2067 Unhandled promise rejection warning on postgres connection issues", () => { @@ -20,7 +20,7 @@ describe("github issues > #2067 Unhandled promise rejection warning on postgres it("should return a catchable error on connection errors in queries", () => Promise.all(connections.map(async connection => { const connectionFailureMessage = "Test error to simulate a connection error"; - if (false/*connection.driver instanceof PostgresDriver*/) { // TODO(uki00a) uncomment this when PostgresDriver is implemented. + if (connection.driver instanceof PostgresDriver) { connection.driver.obtainMasterConnection = () => Promise.reject(new Error(connectionFailureMessage)); connection.driver.obtainSlaveConnection = () => Promise.reject(new Error(connectionFailureMessage)); } diff --git a/test/github-issues/2128/issue-2128.ts b/test/github-issues/2128/issue-2128.ts index ad5a0b483..873da7f93 100644 --- a/test/github-issues/2128/issue-2128.ts +++ b/test/github-issues/2128/issue-2128.ts @@ -3,7 +3,7 @@ import {expect} from "../../deps/chai.ts"; import { closeTestingConnections, createTestingConnections, reloadTestingDatabases } from "../../utils/test-utils.ts"; import { Connection } from "../../../src/connection/Connection.ts"; import { Post } from "./entity/Post.ts"; -//import { PostgresDriver } from "../../../src/driver/postgres/PostgresDriver.ts"; +import { PostgresDriver } from "../../../src/driver/postgres/PostgresDriver.ts"; describe("github issues > #2128 skip preparePersistentValue for value functions", () => { @@ -38,7 +38,7 @@ describe("github issues > #2128 skip preparePersistentValue for value functions" await connection.createQueryBuilder() .update(Post) .set({ - meta: () => false/*connection.driver instanceof PostgresDriver*/ // TODO(uki00a) uncomment this when PostgresDriver is implemented. + meta: () => connection.driver instanceof PostgresDriver ? `'${metaAddition}'::JSONB || meta::JSONB` : `JSON_MERGE('${metaAddition}', meta)` })