fixing failing tests

This commit is contained in:
Umed Khudoiberdiev 2017-07-03 18:37:52 +05:00
parent 555cd69f46
commit d7d91d503c
14 changed files with 18 additions and 50 deletions

View File

@ -8,16 +8,19 @@ export class PostDetails {
id: number;
@Column({
nullable: true
type: String,
nullable: true,
})
authorName: string|null;
@Column({
type: String,
nullable: true
})
comment: string|null;
@Column({
type: String,
nullable: true
})
metadata: string|null;

View File

@ -8,16 +8,19 @@ export class PostDetails {
id: number;
@Column({
type: String,
nullable: true
})
authorName: string|null;
@Column({
type: String,
nullable: true
})
comment: string|null;
@Column({
type: String,
nullable: true
})
metadata: string|null;

View File

@ -4,7 +4,6 @@ import {ObjectLiteral} from "../common/ObjectLiteral";
import {ColumnType} from "./types/ColumnTypes";
import {MappedColumnTypes} from "./types/MappedColumnTypes";
import {SchemaBuilder} from "../schema-builder/SchemaBuilder";
import {EntityManager} from "../entity-manager/EntityManager";
import {DataTypeDefaults} from "./types/DataTypeDefaults";
/**

View File

@ -232,9 +232,6 @@ export class MysqlDriver implements Driver {
} else if (columnMetadata.type === "datetime") {
return DateUtils.mixedDateToUtcDatetimeString(value);
} else if (columnMetadata.type === Object) {
return JSON.stringify(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.simpleArrayToString(value);
}
@ -258,9 +255,6 @@ export class MysqlDriver implements Driver {
} else if (columnMetadata.type === "time") {
return DateUtils.mixedTimeToString(value);
} else if (columnMetadata.type === Object) {
return JSON.parse(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.stringToSimpleArray(value);
}
@ -288,9 +282,6 @@ export class MysqlDriver implements Driver {
} else if (column.type === Boolean) {
type += "tinyint(1)";
} else if (column.type === Object) {
type += "text";
} else if (column.type === "simple-array") {
type += "text";

View File

@ -296,9 +296,6 @@ export class OracleDriver implements Driver {
} else if (column.type === Boolean) {
type += "number(1)";
} else if (column.type === Object) {
type += "text";
} else if (column.type === "simple-array") {
type += "text";

View File

@ -229,7 +229,7 @@ export class PostgresDriver implements Driver {
|| columnMetadata.type === "timestamp without time zone") {
return DateUtils.mixedDateToUtcDatetimeString(value);
} else if (columnMetadata.type === "json" || columnMetadata.type === "jsonb" || columnMetadata.type === Object) {
} else if (columnMetadata.type === "json" || columnMetadata.type === "jsonb") {
return JSON.stringify(value);
} else if (columnMetadata.type === "simple-array") {
@ -316,9 +316,6 @@ export class PostgresDriver implements Driver {
} else if (column.type === Boolean) {
type += "boolean";
} else if (column.type === Object) {
type += "json";
} else if (column.type === "simple-array") {
type += "text";

View File

@ -185,9 +185,6 @@ export class SqliteDriver implements Driver {
} else if (columnMetadata.type === "datetime") {
return DateUtils.mixedDateToUtcDatetimeString(value);
} else if (columnMetadata.type === Object) {
return JSON.stringify(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.simpleArrayToString(value);
}
@ -211,9 +208,6 @@ export class SqliteDriver implements Driver {
} else if (columnMetadata.type === "time") {
return DateUtils.mixedTimeToString(value);
} else if (columnMetadata.type === Object) {
return JSON.parse(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.stringToSimpleArray(value);
}
@ -277,9 +271,6 @@ export class SqliteDriver implements Driver {
} else if (column.type === Boolean) {
type += "boolean";
} else if (column.type === Object) {
type += "text";
} else if (column.type === "simple-array") {
type += "text";

View File

@ -251,9 +251,6 @@ export class SqlServerDriver implements Driver {
|| columnMetadata.type === "datetimeoffset") {
return DateUtils.mixedDateToUtcDatetimeString(value);
} else if (columnMetadata.type === Object) {
return JSON.stringify(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.simpleArrayToString(value);
@ -282,9 +279,6 @@ export class SqlServerDriver implements Driver {
} else if (columnMetadata.type === "time") {
return DateUtils.mixedTimeToString(value);
} else if (columnMetadata.type === Object) {
return JSON.parse(value);
} else if (columnMetadata.type === "simple-array") {
return DateUtils.stringToSimpleArray(value);
}
@ -312,9 +306,6 @@ export class SqlServerDriver implements Driver {
} else if ((column.type as any) === Buffer) {
type += "binary";
} else if (column.type === Object) {
type += "ntext";
} else if (column.type === "simple-array") {
type += "ntext";

View File

@ -257,9 +257,6 @@ export class WebsqlDriver implements Driver {
} else if (column.type === Boolean) {
type += "boolean";
} else if (column.type === Object) {
type += "text";
} else if (column.type === "simple-array") {
type += "text";

View File

@ -296,11 +296,11 @@ export class EntityManager {
return Promise.resolve().then(async () => { // we MUST call "fake" resolve here to make sure all properties of lazily loaded properties are resolved.
// todo: use transaction instead if possible
await this.transaction(async transactionEntityManager => {
if (options && options.data)
transactionEntityManager.data = options.data;
});
// await this.transaction(async transactionEntityManager => {
// if (options && options.data)
// transactionEntityManager.data = options.data;
//
// });
const queryRunner = this.queryRunner || this.connection.createQueryRunner();
const transactionEntityManager = new EntityManagerFactory().create(this.connection, queryRunner);

View File

@ -335,7 +335,7 @@ export class Subject {
entityValue = DateUtils.mixedDateToUtcDatetimeString(entityValue);
databaseValue = DateUtils.mixedDateToUtcDatetimeString(databaseValue);
} else if (column.type === "json" || column.type === "jsonb" || column.type === Object) {
} else if (column.type === "json" || column.type === "jsonb") {
entityValue = JSON.stringify(entityValue);
if (databaseValue !== null && databaseValue !== undefined)
databaseValue = JSON.stringify(databaseValue);

View File

@ -26,7 +26,6 @@ describe("github issues > #215 invalid replacements of join conditions", () => {
abbrev.name = "test";
await connection.manager.save(abbrev);
const post = new Post();
post.author = author;
post.abbreviation = abbrev;

View File

@ -11,7 +11,7 @@ export class Post {
@Column()
title: string;
@Column({ nullable: true })
@Column({ type: String, nullable: true })
text: string|null;
}

View File

@ -2,13 +2,13 @@ import {Column} from "../../../../src/decorator/columns/Column";
export class Duration {
@Column({ nullable: true })
@Column({ type: Number, nullable: true })
minutes: number|null;
@Column({ nullable: true })
@Column({ type: Number, nullable: true })
hours: number|null;
@Column({ nullable: true })
@Column({ type: Number, nullable: true })
days: number|null;
}