Skip to content

Commit

Permalink
Merge branch 'master' into feat/find-return-type
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuki-Sakura committed Jun 23, 2023
2 parents 8bba28e + b1a3a39 commit 1800f0a
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 13 deletions.
23 changes: 12 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ commands:
unzip -qqo node_modules/oracledb/instantclient.zip -d node_modules/oracledb/
rm node_modules/oracledb/instantclient.zip
DEBIAN_FRONTEND=noninteractive sudo apt-get -qq -y install libaio1
sudo apt-get update -qq && sudo apt-get -qq -y install libaio1
(cp /lib/*/libaio.so.* node_modules/oracledb/instantclient_19_8/ ||
cp /usr/lib/*/libaio.so.* node_modules/oracledb/instantclient_19_8/)
fi
environment:
BLOB_URL: https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-basiclite-linux.x64-19.8.0.0.0dbru.zip
DEBIAN_FRONTEND: noninteractive
- save_cache:
name: Save node_modules cache
key: node_modules-{{ checksum "package-lock.json" }}
Expand All @@ -82,7 +83,7 @@ jobs:
lint:
working_directory: ~/typeorm
docker:
- image: circleci/node:16
- image: cimg/node:16.20.0
steps:
- checkout
- install-packages:
Expand All @@ -92,7 +93,7 @@ jobs:
build:
working_directory: ~/typeorm
docker:
- image: circleci/node:16
- image: cimg/node:16.20.0
steps:
- checkout
- install-packages:
Expand All @@ -113,7 +114,7 @@ jobs:
default: "16"
working_directory: ~/typeorm
docker:
- image: circleci/node:<< parameters.node-version >>
- image: cimg/node:<< parameters.node-version >>
steps:
- checkout
- setup_remote_docker
Expand All @@ -139,7 +140,7 @@ jobs:
--volume /typeorm \
--name typeorm-code \
--workdir /typeorm \
circleci/node:<< parameters.node-version >> \
cimg/node:<< parameters.node-version >> \
/bin/bash -c "sudo chmod 777 /typeorm && sudo chown circleci /typeorm"
docker cp ./ typeorm-code:/typeorm
- run:
Expand Down Expand Up @@ -194,7 +195,7 @@ jobs:
--tty \
--workdir /typeorm \
--name typeorm-testrunner \
circleci/node:<< parameters.node-version >> \
cimg/node:<< parameters.node-version >> \
npx nyc npm run test-fast
docker cp typeorm-testrunner:/typeorm/coverage/ ./
Expand All @@ -220,26 +221,26 @@ workflows:
matrix:
parameters:
node-version:
- "14"
- "16"
- "14.21.3"
- "16.20.0"
- test:
name: test (cockroachdb) - Node v16
requires:
- lint
- build
databases: "cockroachdb"
node-version: "16"
node-version: "16.20.0"
- test:
name: test (oracle) - Node v16
requires:
- lint
- build
databases: "oracle"
node-version: "16"
node-version: "16.20.0"
- test:
name: test (postgres 12) - Node v16
requires:
- lint
- build
databases: "postgres-12"
node-version: "16"
node-version: "16.20.0"
5 changes: 4 additions & 1 deletion src/driver/mysql/MysqlDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,10 @@ export class MysqlDriver implements Driver {
* fix https://github.com/typeorm/typeorm/issues/1139
* note that if the db did support uuid column type it wouldn't have been defaulted to varchar
*/
if (column.generationStrategy === "uuid" && column.type === "varchar")
if (
column.generationStrategy === "uuid" &&
!this.uuidColumnTypeSuported
)
return "36"

switch (column.type) {
Expand Down
2 changes: 1 addition & 1 deletion src/migration/MigrationExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ export class MigrationExecutor {
this.queryRunner || this.connection.createQueryRunner()

try {
return callback(queryRunner)
return await callback(queryRunner)
} finally {
if (!this.queryRunner) {
await queryRunner.release()
Expand Down
19 changes: 19 additions & 0 deletions test/github-issues/10040/entity/person.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
Column,
Entity,
OneToMany,
PrimaryGeneratedColumn,
} from "../../../../src"
import { Todo } from "./todo"

@Entity({ name: "person" })
export class Person {
@PrimaryGeneratedColumn("uuid")
id: string

@Column("varchar")
name: string

@OneToMany(() => Todo, (o) => o.owner)
todos: Todo[]
}
19 changes: 19 additions & 0 deletions test/github-issues/10040/entity/todo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
Column,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
} from "../../../../src"
import { Person } from "./person"

@Entity({ name: "todo" })
export class Todo {
@PrimaryGeneratedColumn("uuid")
id: string

@Column("varchar")
description: string

@ManyToOne(() => Person, (o) => o.todos)
owner: Person
}
33 changes: 33 additions & 0 deletions test/github-issues/10040/issue-10040.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { expect } from "chai"
import { DataSource } from "../../../src"
import {
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases,
} from "../../utils/test-utils"
import { Person } from "./entity/person"
import { Todo } from "./entity/todo"

describe("github issues > #10040 TypeORM synchronize database even if it is up to date", () => {
let dataSources: DataSource[]

before(async () => {
dataSources = await createTestingConnections({
entities: [Person, Todo],
enabledDrivers: ["mysql"],
})
})

beforeEach(() => reloadTestingDatabases(dataSources))
after(() => closeTestingConnections(dataSources))

it("should return an empty array for the upQueries after sync", async () => {
await Promise.all(
dataSources.map(async (dataSource) => {
await dataSource.synchronize()
const logs = await dataSource.driver.createSchemaBuilder().log()
expect(logs.upQueries.length).to.be.eql(0)
}),
)
})
})

0 comments on commit 1800f0a

Please sign in to comment.