removed useless "schemaCreate: true" from tests

This commit is contained in:
Umed Khudoiberdiev 2017-11-07 18:52:21 +05:00
parent c49e362549
commit 620703d351
184 changed files with 14 additions and 459 deletions

View File

@ -26,7 +26,7 @@ import {RepositoryFactory} from "../repository/RepositoryFactory";
import {TreeRepositoryNotSupportedError} from "../error/TreeRepositoryNotSupportedError";
import {EntityMetadata} from "../metadata/EntityMetadata";
import {QueryPartialEntity} from "../query-builder/QueryPartialEntity";
import {EntityPersitor} from "../persistence/EntityPersitor";
import {EntityPersistExecutor} from "../persistence/EntityPersistExecutor";
import {ObjectID} from "../driver/mongodb/typings";
/**
@ -276,7 +276,7 @@ export class EntityManager {
const options = target ? maybeOptions : maybeEntityOrOptions as SaveOptions;
// execute save operation
return new EntityPersitor(this.connection, this.queryRunner, "save", target, entity, options)
return new EntityPersistExecutor(this.connection, this.queryRunner, "save", target, entity, options)
.execute()
.then(() => entity);
}
@ -367,7 +367,7 @@ export class EntityManager {
const options = target ? maybeOptions : maybeEntityOrOptions as SaveOptions;
// execute save operation
return new EntityPersitor(this.connection, this.queryRunner, "remove", target, entity, options)
return new EntityPersistExecutor(this.connection, this.queryRunner, "remove", target, entity, options)
.execute()
.then(() => entity);
}

View File

@ -17,7 +17,7 @@ import {CascadesSubjectBuilder} from "./subject-builder/CascadesSubjectBuilder";
/**
* Persists a single entity or multiple entities - saves or removes them.
*/
export class EntityPersitor {
export class EntityPersistExecutor {
// -------------------------------------------------------------------------
// Constructor
@ -145,6 +145,7 @@ export class EntityPersitor {
// next step is to load database entities of all operate subjects
await new SubjectDatabaseEntityLoader(queryRunner, subjects).load();
// build all related subjects and change maps
new OneToManySubjectBuilder(subjects).build();
new OneToOneInverseSideSubjectBuilder(subjects).build();
new ManyToManySubjectBuilder(subjects).build();
@ -156,7 +157,6 @@ export class EntityPersitor {
* Builds only remove operations for entity that is being removed.
*/
protected async remove(queryRunner: QueryRunner, metadata: EntityMetadata, entity: ObjectLiteral): Promise<Subject[]> {
const subjects: Subject[] = [];
// create subject for currently removed entity and mark that it must be removed
const mainSubject = new Subject({
@ -164,7 +164,7 @@ export class EntityPersitor {
entity: entity,
mustBeRemoved: true,
});
subjects.push(mainSubject);
const subjects: Subject[] = [mainSubject];
// next step is to load database entities for all operate subjects
await new SubjectDatabaseEntityLoader(queryRunner, subjects).load();

View File

@ -146,8 +146,9 @@ export class Subject {
/**
* Creates a value set needs to be inserted / updated in the database.
* Value set is based on the entity and change maps of the subject.
* Important note: this method pops data from this subject's change maps.
*/
createValueSet(): ObjectLiteral {
createValueSetAndPopChangeMap(): ObjectLiteral {
const changeMapsWithoutValues: SubjectChangeMap[] = [];
const changeSet = this.changeMaps.reduce((updateMap, changeMap) => {
let value = changeMap.value;
@ -159,7 +160,6 @@ export class Subject {
// otherwise simply use an entity which cannot be just inserted at the moment and have all necessary data
value = value.insertedValueSet ? value.insertedValueSet : value.entity;
}
// value = changeMap.valueFactory ? changeMap.valueFactory(value) : changeMap.column.createValueMap(value);
let valueMap: ObjectLiteral|undefined;

View File

@ -14,7 +14,8 @@ export class SubjectDatabaseEntityLoader {
// Constructor
// ---------------------------------------------------------------------
constructor(protected queryRunner: QueryRunner, protected subjects: Subject[]) {
constructor(protected queryRunner: QueryRunner,
protected subjects: Subject[]) {
}
// ---------------------------------------------------------------------

View File

@ -137,7 +137,7 @@ export class SubjectExecutor {
.createQueryBuilder()
.insert()
.into(subject.metadata.target)
.values(subject.createValueSet())
.values(subject.createValueSetAndPopChangeMap())
.execute();
subject.identifier = insertResult.identifiers[0];
@ -158,7 +158,7 @@ export class SubjectExecutor {
return this.queryRunner.manager
.createQueryBuilder()
.update(subject.metadata.target)
.set(subject.createValueSet())
.set(subject.createValueSetAndPopChangeMap())
.where(subject.identifier)
.execute();
}));

View File

@ -8,7 +8,6 @@ describe.skip("benchmark > bulk-save", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe.skip("cascades > should insert by cascades from both sides (#57)", () =
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("database schema > column collation > mssql", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mssql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -10,7 +10,6 @@ describe("database schema > column collation > mysql", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mysql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -10,7 +10,6 @@ describe("database schema > column collation > postgres", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["postgres"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe.skip("database schema > column collation > sqlite", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["sqlite"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > column length > mssql", () => {
connections = await createTestingConnections({
entities: [Post],
enabledDrivers: ["mssql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > column length > mssql", () => {
connections = await createTestingConnections({
entities: [Post],
enabledDrivers: ["mysql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > column length > mssql", () => {
connections = await createTestingConnections({
entities: [Post],
enabledDrivers: ["postgres"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > column length > mssql", () => {
connections = await createTestingConnections({
entities: [Post],
enabledDrivers: ["sqlite"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -13,7 +13,6 @@ describe("database schema > column types > mssql", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mssql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -13,7 +13,6 @@ describe("database schema > column types > mysql", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mysql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -12,7 +12,6 @@ describe("database schema > column types > postgres", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["postgres"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > column types > sqlite", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["sqlite"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -12,7 +12,6 @@ describe("indices > reading index from entity schema and updating database", ()
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [Person],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("database schema > migrations", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mssql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("database schema > mssql-parameters", () => {
connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
enabledDrivers: ["mssql"],
schemaCreate: true,
dropSchema: true,
});
});

View File

@ -11,7 +11,6 @@ describe("sequences > creating a sequence and marking the column as generated",
before(async () => connections = await createTestingConnections({
entities: [Person],
enabledDrivers: ["postgres"],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("indices > reading index from entity schema and updating database", ()
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [Person],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("indices > reading index from entity schema and updating database", ()
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [Person, User],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("query builder > relation-count-decorator-many-to-many > many-to-many",
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("decorators > relation-count-decorator > one-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("decorators > relation-id-decorator > many-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("decorators > relation-id-decorator > many-to-one", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("decorators > relation-id > one-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("decorators > relation-id > one-to-one", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("driver > convert raw results to entity", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [Post],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("embedded > basic functionality", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-many-case1", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-many-case2", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-many-case3", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-many-case4", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-many-case5", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-one-case1", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-one-case2", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-one-case3", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-one-case4", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-many-to-one-case5", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("embedded > embedded-one-to-one", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -16,7 +16,6 @@ describe("embedded > embedded-with-special-columns", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("embedded > multiple-primary-columns-with-nested-embed", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("embedded > multiple-primary-column", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("embedded > outer-primary-column", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("embedded > prefix functionality", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("entity-metadata > property-map", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("entity-model", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("indices > reading index from entity schema and updating database", ()
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entitySchemas: [<any>PersonSchema],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -8,7 +8,6 @@ describe("indices > basic unique index test", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("metadata-builder > ColumnMetadata", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("persistence > cascade operations with custom name", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -1,78 +0,0 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import {Column} from "../../../../../src/decorator/columns/Column";
import {Post} from "./Post";
import {OneToMany} from "../../../../../src/decorator/relations/OneToMany";
import {Photo} from "./Photo";
import {ManyToMany} from "../../../../../src/decorator/relations/ManyToMany";
import {JoinTable} from "../../../../../src/decorator/relations/JoinTable";
import {ManyToOne} from "../../../../../src/decorator/relations/ManyToOne";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne";
import {JoinColumn} from "../../../../../src/decorator/relations/JoinColumn";
@Entity()
export class Category {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@OneToMany(type => Post, post => post.manyToOneCategory, {
cascadeInsert: true,
cascadeUpdate: true
})
oneToManyPosts: Post[];
@OneToMany(type => Post, post => post.noCascadeManyToOneCategory, {
cascadeInsert: false,
cascadeUpdate: false
})
noCascadeOneToManyPosts: Post[];
@OneToOne(type => Post, post => post.oneToOneCategory, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true,
})
@JoinColumn()
oneToOneOwnerPost: Post;
@OneToOne(type => Post, post => post.noCascadeOneToOneCategory, {
cascadeInsert: false,
cascadeUpdate: false,
cascadeRemove: false,
})
@JoinColumn()
noCascadeOneToOnePost: Post;
@ManyToMany(type => Post, post => post.manyToManyOwnerCategories, {
cascadeInsert: true,
cascadeUpdate: true,
})
@JoinTable()
manyToManyPosts: Post[];
@ManyToMany(type => Post, post => post.noCascadeManyToManyOwnerCategories, {
cascadeInsert: false,
cascadeUpdate: false,
})
@JoinTable()
noCascadeManyToManyPosts: Post[];
@ManyToMany(type => Photo, {
cascadeInsert: true,
cascadeUpdate: true
})
@JoinTable()
photos: Photo[];
@ManyToOne(type => Photo, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
})
photo: Photo|null;
}

View File

@ -1,31 +0,0 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import {Column} from "../../../../../src/decorator/columns/Column";
import {ManyToOne} from "../../../../../src/decorator/relations/ManyToOne";
import {Post} from "../entity/Post";
import {ManyToMany} from "../../../../../src/decorator/relations/ManyToMany";
@Entity()
export class Photo {
@PrimaryGeneratedColumn()
id: number;
@Column()
url: string;
@ManyToOne(type => Post, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true,
nullable: false
})
post: Post|null;
@ManyToMany(type => Post, photo => photo.photos, {
cascadeInsert: true,
cascadeUpdate: true,
})
posts: Post[];
}

View File

@ -1,76 +0,0 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import {Column} from "../../../../../src/decorator/columns/Column";
import {ManyToOne} from "../../../../../src/decorator/relations/ManyToOne";
import {Category} from "./Category";
import {Photo} from "./Photo";
import {ManyToMany} from "../../../../../src/decorator/relations/ManyToMany";
import {JoinTable} from "../../../../../src/decorator/relations/JoinTable";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne";
@Entity()
export class Post {
@PrimaryGeneratedColumn()
id: number;
@Column()
title: string;
@ManyToOne(type => Category, category => category.oneToManyPosts, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true,
})
manyToOneCategory: Category;
@ManyToOne(type => Category, category => category.noCascadeOneToManyPosts, {
cascadeInsert: false,
cascadeUpdate: false,
cascadeRemove: false,
})
noCascadeManyToOneCategory: Category;
@OneToOne(type => Category, category => category.oneToOneOwnerPost, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true,
})
oneToOneCategory: Category;
@OneToOne(type => Category, category => category.noCascadeOneToOnePost, {
cascadeInsert: false,
cascadeUpdate: false,
cascadeRemove: false,
})
noCascadeOneToOneCategory: Category;
@ManyToMany(type => Category, category => category.manyToManyPosts, {
cascadeInsert: true,
cascadeUpdate: true,
})
@JoinTable()
manyToManyOwnerCategories: Category[];
@ManyToMany(type => Category, category => category.noCascadeManyToManyPosts, {
cascadeInsert: false,
cascadeUpdate: false,
})
@JoinTable()
noCascadeManyToManyOwnerCategories: Category[];
@ManyToMany(type => Photo, photo => photo.posts, {
cascadeInsert: true,
cascadeUpdate: true,
})
@JoinTable()
photos: Photo[];
@ManyToMany(type => Photo, {
cascadeInsert: true,
cascadeUpdate: true,
})
@JoinTable()
noInversePhotos: Photo[];
}

View File

@ -1,85 +0,0 @@
import "reflect-metadata";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils";
import {Connection} from "../../../../src/connection/Connection";
import {Post} from "./entity/Post";
import {Category} from "./entity/Category";
describe.skip("persistence > insert operations", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
describe("cascade insert", function() {
it("should work perfectly", () => Promise.all(connections.map(async connection => {
// create category
const category1 = new Category();
category1.name = "Category saved by cascades #1";
// category1.onePost = post1;
// create post
const post1 = new Post();
post1.title = "Hello Post #1";
// todo(next): check out to one
// create photos
/* const photo1 = new Photo();
photo1.url = "http://me.com/photo";
photo1.post = post1;
const photo2 = new Photo();
photo2.url = "http://me.com/photo";
photo2.post = post1;*/
// post1.category = category1;
// post1.category.photos = [photo1, photo2];
await connection.manager.save(post1);
await connection.manager.save(category1);
console.log("********************************************************");
/*const posts = await connection.manager
.createQueryBuilder(Post, "post")
.leftJoinAndSelect("post.category", "category")
// .innerJoinAndSelect("post.photos", "photos")
.getResults();
posts[0].title = "Updated Post #1";
console.log("********************************************************");
console.log("posts: ", posts);
// posts[0].category = null; // todo: uncomment to check remove
console.log("removing post's category: ", posts[0]);
await connection.manager.save(posts[0]);*/
/* await connection.manager.save([photo1, photo2]);
post1.photos = [photo1];
await connection.manager.save(post1);
console.log("********************************************************");
console.log("********************************************************");
post1.photos = [photo1, photo2];
await connection.manager.save(post1);
console.log("********************************************************");
console.log("********************************************************");
post1.title = "Updated Post";
await connection.manager.save(post1);*/
})));
});
});

View File

@ -9,7 +9,6 @@ describe("persistence > insert > update-relation-columns-after-insertion", () =>
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));

View File

@ -9,7 +9,6 @@ describe("persistence > multi primary keys", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("persistence > multi primary keys", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("persistence > null and default behaviour", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));

View File

@ -15,7 +15,6 @@ describe("persistence > partial persist", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -33,7 +33,6 @@ describe("persistence > order of persistence execution operations", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("query builder > brackets", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("query builder > delete", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -13,7 +13,6 @@ describe("query builder > joins", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -22,7 +22,6 @@ describe("query builder > locking", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("query builder > order-by", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("query builder > load-relation-count-and-map > many-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("query builder > load-relation-count-and-map > one-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -16,7 +16,6 @@ describe("query builder > relation-id > many-to-many > basic-functionality", ()
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > many-to-many > embedded-with-multiple-pk
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > many-to-many > embedded", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -15,7 +15,6 @@ describe("query builder > relation-id > many-to-many > multiple-pk", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -16,7 +16,6 @@ describe("query builder > relation-id > many-to-one > basic-functionality", () =
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > many-to-one > embedded-with-multiple-pk"
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > many-to-one > embedded", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -15,7 +15,6 @@ describe("query builder > relation-id > many-to-one > multiple-pk", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -15,7 +15,6 @@ describe("query builder > relation-id > one-to-many > basic-functionality", () =
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > one-to-many > embedded-with-multiple-pk"
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > one-to-many > embedded", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -15,7 +15,6 @@ describe("query builder > relation-id > one-to-many > multiple-pk", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -14,7 +14,6 @@ describe("query builder > relation-id > one-to-one > basic-functionality", () =>
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > one-to-one > embedded-with-multiple-pk",
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -17,7 +17,6 @@ describe("query builder > relation-id > one-to-one > embedded", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -15,7 +15,6 @@ describe("query builder > relation-id > one-to-one > multiple-pk", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -9,7 +9,6 @@ describe("query builder > select", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -14,7 +14,6 @@ describe("query builder > sub-query", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("query builder > update", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("relations > custom-referenced-column-name", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -27,7 +27,6 @@ describe("basic-lazy-relations", () => {
Category,
],
entitySchemas: [ userSchema, profileSchema ],
schemaCreate: true,
dropSchema: true,
enabledDrivers: ["postgres"] // we can properly test lazy-relations only on one platform
}));

View File

@ -20,7 +20,6 @@ describe("named-columns-lazy-relations", () => {
Post,
Category,
],
schemaCreate: true,
dropSchema: true,
enabledDrivers: ["postgres"] // we can properly test lazy-relations only on one platform
}));

View File

@ -20,7 +20,6 @@ describe("named-tables-and-columns-lazy-relations", () => {
Post,
Category,
],
schemaCreate: true,
dropSchema: true,
enabledDrivers: ["postgres"] // we can properly test lazy-relations only on one platform
}));

View File

@ -20,7 +20,6 @@ describe("named-tables-lazy-relations", () => {
Post,
Category,
],
schemaCreate: true,
dropSchema: true,
enabledDrivers: ["postgres"] // we can properly test lazy-relations only on one platform
}));

View File

@ -11,7 +11,6 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -10,7 +10,6 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -11,7 +11,6 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

View File

@ -12,7 +12,6 @@ describe("relations > multiple-primary-keys > other-cases", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));

Some files were not shown because too many files have changed in this diff Show More