mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
enabled skipped tests;
fixed tests to pass on crdb `master`;
This commit is contained in:
parent
15a3e876f4
commit
ee9ba99f74
@ -63,7 +63,7 @@ services:
|
||||
|
||||
# cockroachdb
|
||||
cockroachdb:
|
||||
image: "cockroachdb/cockroach:v2.1.5"
|
||||
image: "cockroachdb/cockroach-unstable:latest"
|
||||
container_name: "typeorm-cockroachdb"
|
||||
command: start --insecure
|
||||
ports:
|
||||
|
||||
@ -19,19 +19,19 @@ describe("database-schema > rowid-column", () => {
|
||||
const table = await queryRunner.getTable("person");
|
||||
await queryRunner.release();
|
||||
|
||||
table!.findColumnByName("id")!.type.should.be.equal("int");
|
||||
table!.findColumnByName("id")!.type.should.be.equal("int8");
|
||||
table!.findColumnByName("id")!.isGenerated.should.be.equal(true);
|
||||
table!.findColumnByName("id")!.generationStrategy!.should.be.equal("rowid");
|
||||
|
||||
table!.findColumnByName("id2")!.type.should.be.equal("int");
|
||||
table!.findColumnByName("id2")!.type.should.be.equal("int8");
|
||||
table!.findColumnByName("id2")!.isGenerated.should.be.equal(true);
|
||||
table!.findColumnByName("id2")!.generationStrategy!.should.be.equal("rowid");
|
||||
|
||||
table!.findColumnByName("id3")!.type.should.be.equal("int");
|
||||
table!.findColumnByName("id3")!.type.should.be.equal("int8");
|
||||
table!.findColumnByName("id3")!.isGenerated.should.be.equal(true);
|
||||
table!.findColumnByName("id3")!.generationStrategy!.should.be.equal("rowid");
|
||||
|
||||
table!.findColumnByName("id4")!.type.should.be.equal("int");
|
||||
table!.findColumnByName("id4")!.type.should.be.equal("int8");
|
||||
table!.findColumnByName("id4")!.isGenerated.should.be.equal(true);
|
||||
table!.findColumnByName("id4")!.generationStrategy!.should.be.equal("rowid");
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
import {expect} from "chai";
|
||||
import {CockroachDriver} from "../../../../../src/driver/cockroachdb/CockroachDriver";
|
||||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils";
|
||||
import {Connection} from "../../../../../src/connection/Connection";
|
||||
import {Connection} from "../../../../../src";
|
||||
import {Category} from "./entity/Category";
|
||||
import {Post} from "./entity/Post";
|
||||
import {Image} from "./entity/Image";
|
||||
@ -219,10 +218,6 @@ describe("query builder > relation-count-decorator-many-to-many > many-to-many",
|
||||
|
||||
it("should load relation count on both sides of relation", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// todo: issue with GROUP BY
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const category1 = new Category();
|
||||
category1.id = 1;
|
||||
category1.name = "cars";
|
||||
@ -256,8 +251,6 @@ describe("query builder > relation-count-decorator-many-to-many > many-to-many",
|
||||
.addOrderBy("post.id, categories.id")
|
||||
.getMany();
|
||||
|
||||
// console.log(loadedPosts);
|
||||
|
||||
expect(loadedPosts![0].categoryCount).to.be.equal(3);
|
||||
expect(loadedPosts![0].categories[0].postCount).to.be.equal(2);
|
||||
expect(loadedPosts![0].categories[1].postCount).to.be.equal(1);
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
import {expect} from "chai";
|
||||
import {CockroachDriver} from "../../../../../src/driver/cockroachdb/CockroachDriver";
|
||||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils";
|
||||
import {Connection} from "../../../../../src/connection/Connection";
|
||||
import {Connection} from "../../../../../src";
|
||||
import {Category} from "./entity/Category";
|
||||
import {Post} from "./entity/Post";
|
||||
import {Image} from "./entity/Image";
|
||||
@ -204,10 +203,6 @@ describe("query builder > load-relation-count-and-map > many-to-many", () => {
|
||||
|
||||
it("should load relation count on both sides of relation", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// todo: issue with GROUP BY
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const category1 = new Category();
|
||||
category1.name = "cars";
|
||||
await connection.manager.save(category1);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import "reflect-metadata";
|
||||
import {expect} from "chai";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
import {Connection} from "../../../src";
|
||||
import {CockroachDriver} from "../../../src/driver/cockroachdb/CockroachDriver";
|
||||
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils";
|
||||
import {Table} from "../../../src/schema-builder/table/Table";
|
||||
import {Table} from "../../../src";
|
||||
import {SqlServerDriver} from "../../../src/driver/sqlserver/SqlServerDriver";
|
||||
import {PostgresDriver} from "../../../src/driver/postgres/PostgresDriver";
|
||||
import {AbstractSqliteDriver} from "../../../src/driver/sqlite-abstract/AbstractSqliteDriver";
|
||||
@ -23,10 +23,6 @@ describe("query runner > rename column", () => {
|
||||
|
||||
it("should correctly rename column and revert rename", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// TODO: https://github.com/cockroachdb/cockroach/issues/32555
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
let table = await queryRunner.getTable("post");
|
||||
@ -57,10 +53,6 @@ describe("query runner > rename column", () => {
|
||||
|
||||
it("should correctly rename column with all constraints and revert rename", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// TODO: https://github.com/cockroachdb/cockroach/issues/32555
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
|
||||
let table = await queryRunner.getTable("post");
|
||||
@ -68,7 +60,9 @@ describe("query runner > rename column", () => {
|
||||
await queryRunner.renameColumn(table!, idColumn, "id2");
|
||||
|
||||
// should successfully drop pk if pk constraint was correctly renamed.
|
||||
await queryRunner.dropPrimaryKey(table!);
|
||||
// CockroachDB does not allow to drop PK
|
||||
if (!(connection.driver instanceof CockroachDriver))
|
||||
await queryRunner.dropPrimaryKey(table!);
|
||||
|
||||
table = await queryRunner.getTable("post");
|
||||
expect(table!.findColumnByName("id")).to.be.undefined;
|
||||
@ -103,10 +97,6 @@ describe("query runner > rename column", () => {
|
||||
|
||||
it("should correctly rename column with all constraints in custom table schema and database and revert rename", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// TODO: https://github.com/cockroachdb/cockroach/issues/32555
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
let table: Table|undefined;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import "reflect-metadata";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
import {Connection} from "../../../src";
|
||||
import {CockroachDriver} from "../../../src/driver/cockroachdb/CockroachDriver";
|
||||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils";
|
||||
import {expect} from "chai";
|
||||
@ -74,10 +74,6 @@ describe("schema builder > change column", () => {
|
||||
|
||||
it("should correctly change column type", () => PromiseUtils.runInSequence(connections, async connection => {
|
||||
|
||||
// TODO: https://github.com/cockroachdb/cockroach/issues/34710
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const postMetadata = connection.getMetadata(Post);
|
||||
const versionColumn = postMetadata.findColumnWithPropertyName("version")!;
|
||||
versionColumn.type = "int";
|
||||
|
||||
@ -18,16 +18,17 @@ describe("schema builder > drop column", () => {
|
||||
|
||||
it("should correctly drop column", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
// TODO: https://github.com/cockroachdb/cockroach/issues/34710
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
const studentMetadata = connection.getMetadata("student");
|
||||
const removedColumns = studentMetadata.columns.filter(column => ["name", "faculty"].indexOf(column.propertyName) !== -1);
|
||||
removedColumns.forEach(column => {
|
||||
studentMetadata.columns.splice(studentMetadata.columns.indexOf(column), 1);
|
||||
});
|
||||
studentMetadata.indices = [];
|
||||
|
||||
// in real sync indices removes automatically
|
||||
studentMetadata.indices = studentMetadata.indices.filter(index => {
|
||||
return !index.columns.find(column => ["name", "facultyId"].indexOf(column.databaseName) !== -1);
|
||||
});
|
||||
|
||||
const removedForeignKey = studentMetadata.foreignKeys.find(fk => {
|
||||
return !!fk.columns.find(column => column.propertyName === "faculty");
|
||||
});
|
||||
@ -41,7 +42,13 @@ describe("schema builder > drop column", () => {
|
||||
|
||||
expect(studentTable!.findColumnByName("name")).to.be.undefined;
|
||||
expect(studentTable!.findColumnByName("faculty")).to.be.undefined;
|
||||
studentTable!.indices.length.should.be.equal(0);
|
||||
|
||||
// CockroachDB creates indices for foreign keys
|
||||
if (connection.driver instanceof CockroachDriver) {
|
||||
studentTable!.indices.length.should.be.equal(1);
|
||||
} else {
|
||||
studentTable!.indices.length.should.be.equal(0);
|
||||
}
|
||||
studentTable!.foreignKeys.length.should.be.equal(1);
|
||||
|
||||
})));
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import "reflect-metadata";
|
||||
import {CockroachDriver} from "../../../src/driver/cockroachdb/CockroachDriver";
|
||||
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
import {BaseEntity} from "../../../src/repository/BaseEntity";
|
||||
@ -16,10 +15,6 @@ describe("github issues > #1261 onDelete property on foreign key is not modified
|
||||
|
||||
it("should modify onDelete property on foreign key on sync", () => PromiseUtils.runInSequence(connections, async connection => {
|
||||
|
||||
// TODO: issue in CRDB
|
||||
if (connection.driver instanceof CockroachDriver)
|
||||
return;
|
||||
|
||||
await connection.synchronize();
|
||||
BaseEntity.useConnection(connection);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
import { closeTestingConnections, createTestingConnections, reloadTestingDatabases } from "../../utils/test-utils";
|
||||
import { Connection } from "../../../src/connection/Connection";
|
||||
import { EntityMetadata } from "../../../src/metadata/EntityMetadata";
|
||||
import { Connection } from "../../../src";
|
||||
import { EntityMetadata } from "../../../src";
|
||||
import { Person } from "./entity/person";
|
||||
|
||||
describe("github issues > #197 Fails to drop indexes when removing fields", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user