From b34afb9586ac954919420b6b1be101bcc1f304fc Mon Sep 17 00:00:00 2001 From: Kononnable Date: Sat, 14 Apr 2018 14:23:18 +0200 Subject: [PATCH] upgraded supported types to types supported by typeorm@0.2.0 --- src/drivers/MssqlDriver.ts | 136 ++++++------ src/drivers/MysqlDriver.ts | 143 ++++++------- src/drivers/PostgresDriver.ts | 160 ++++++++++---- .../entityTypes/mariadb/entity/Post.ts | 39 +++- .../entityTypes/mssql/entity/Post.ts | 133 ++++++------ .../entityTypes/mysql/entity/Post.ts | 36 +++- .../entityTypes/postgres/entity/Post.ts | 201 +++++++----------- 7 files changed, 455 insertions(+), 393 deletions(-) diff --git a/src/drivers/MssqlDriver.ts b/src/drivers/MssqlDriver.ts index ea11b22..865d41e 100644 --- a/src/drivers/MssqlDriver.ts +++ b/src/drivers/MssqlDriver.ts @@ -62,6 +62,25 @@ export class MssqlDriver extends AbstractDriver { colInfo.default = resp.COLUMN_DEFAULT; colInfo.sql_type = resp.DATA_TYPE; switch (resp.DATA_TYPE) { + case "bigint": + colInfo.ts_type = "string"; + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; + case "bit": + colInfo.ts_type = "boolean"; + break; + case "decimal": + colInfo.ts_type = "number"; + colInfo.numericPrecision = resp.NUMERIC_PRECISION; + colInfo.numericScale = resp.NUMERIC_SCALE; + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; case "int": colInfo.ts_type = "number"; colInfo.char_max_lenght = @@ -69,8 +88,13 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "tinyint": + case "money": colInfo.ts_type = "number"; + break; + case "numeric": + colInfo.ts_type = "number"; + colInfo.numericPrecision = resp.NUMERIC_PRECISION; + colInfo.numericScale = resp.NUMERIC_SCALE; colInfo.char_max_lenght = resp.CHARACTER_MAXIMUM_LENGTH > 0 ? resp.CHARACTER_MAXIMUM_LENGTH @@ -83,8 +107,15 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "bit": - colInfo.ts_type = "boolean"; + case "smallmoney": + colInfo.ts_type = "number"; + break; + case "tinyint": + colInfo.ts_type = "number"; + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; break; case "float": colInfo.ts_type = "number"; @@ -94,8 +125,8 @@ export class MssqlDriver extends AbstractDriver { : null; colInfo.numericPrecision = resp.NUMERIC_PRECISION; break; - case "bigint": - colInfo.ts_type = "string"; + case "real": + colInfo.ts_type = "number"; colInfo.char_max_lenght = resp.CHARACTER_MAXIMUM_LENGTH > 0 ? resp.CHARACTER_MAXIMUM_LENGTH @@ -104,13 +135,21 @@ export class MssqlDriver extends AbstractDriver { case "date": colInfo.ts_type = "Date"; break; - case "time": + case "datetime2": colInfo.ts_type = "Date"; + colInfo.numericPrecision = resp.NUMERIC_PRECISION; break; case "datetime": colInfo.ts_type = "Date"; break; - case "timestamp": + case "datetimeoffset": + colInfo.ts_type = "Date"; + colInfo.numericPrecision = resp.NUMERIC_PRECISION; + break; + case "smalldatetime": + colInfo.ts_type = "Date"; + break; + case "time": colInfo.ts_type = "Date"; break; case "char": @@ -120,6 +159,16 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; + case "text": + colInfo.ts_type = "string"; + break; + case "varchar": + colInfo.ts_type = "string"; + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; case "nchar": colInfo.ts_type = "string"; colInfo.char_max_lenght = @@ -127,16 +176,10 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "text": - colInfo.ts_type = "string"; - break; case "ntext": colInfo.ts_type = "string"; break; - case "uniqueidentifier": - colInfo.ts_type = "string"; - break; - case "varchar": + case "nvarchar": colInfo.ts_type = "string"; colInfo.char_max_lenght = resp.CHARACTER_MAXIMUM_LENGTH > 0 @@ -150,6 +193,9 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; + case "image": + colInfo.ts_type = "Buffer"; + break; case "varbinary": colInfo.ts_type = "Buffer"; colInfo.char_max_lenght = @@ -157,65 +203,27 @@ export class MssqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "image": - colInfo.ts_type = "Buffer"; - break; - case "nvarchar": + case "hierarchyid": colInfo.ts_type = "string"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; break; - case "money": - colInfo.ts_type = "number"; + case "sql_variant": + colInfo.ts_type = "string"; break; - case "smallmoney": - colInfo.ts_type = "number"; - break; - case "real": - colInfo.ts_type = "number"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "decimal": - colInfo.ts_type = "number"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; - colInfo.numericScale = resp.NUMERIC_SCALE; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "numeric": - colInfo.ts_type = "number"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; - colInfo.numericScale = resp.NUMERIC_SCALE; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "datetime2": + case "timestamp": colInfo.ts_type = "Date"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; break; - case "time": - colInfo.ts_type = "Date"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; - break; - case "datetimeoffset": - colInfo.ts_type = "Date"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; - break; - case "smalldatetime": - colInfo.ts_type = "Date"; + case "uniqueidentifier": + colInfo.ts_type = "string"; break; case "xml": colInfo.ts_type = "string"; break; + case "geometry": + colInfo.ts_type = "string"; + break; + case "geography": + colInfo.ts_type = "string"; + break; default: TomgUtils.LogError( `Unknown column type: ${ diff --git a/src/drivers/MysqlDriver.ts b/src/drivers/MysqlDriver.ts index 5eab6c7..01722fe 100644 --- a/src/drivers/MysqlDriver.ts +++ b/src/drivers/MysqlDriver.ts @@ -88,8 +88,19 @@ export class MysqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "bit": - colInfo.ts_type = "boolean"; + case "mediumint": + colInfo.ts_type = "number"; + colInfo.width = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; + case "bigint": + colInfo.ts_type = "string"; + colInfo.width = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; break; case "float": colInfo.ts_type = "number"; @@ -98,9 +109,18 @@ export class MysqlDriver extends AbstractDriver { ? resp.CHARACTER_MAXIMUM_LENGTH : null; break; - case "bigint": + case "double": colInfo.ts_type = "number"; - colInfo.width = + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; + case "decimal": + colInfo.ts_type = "string"; + colInfo.numericPrecision = resp.NUMERIC_PRECISION; + colInfo.numericScale = resp.NUMERIC_SCALE; + colInfo.char_max_lenght = resp.CHARACTER_MAXIMUM_LENGTH > 0 ? resp.CHARACTER_MAXIMUM_LENGTH : null; @@ -108,41 +128,34 @@ export class MysqlDriver extends AbstractDriver { case "date": colInfo.ts_type = "string"; break; - case "time": - colInfo.ts_type = "string"; - break; case "datetime": colInfo.ts_type = "Date"; break; - case "char": - colInfo.ts_type = "string"; - break; - case "nchar": - colInfo.ts_type = "string"; - break; - case "text": - colInfo.ts_type = "string"; - break; - case "ntext": - colInfo.ts_type = "string"; - break; - - case "mediumint": - colInfo.ts_type = "number"; - colInfo.width = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; case "timestamp": colInfo.ts_type = "Date"; break; + case "time": + colInfo.ts_type = "string"; + break; case "year": colInfo.ts_type = "number"; break; + case "char": + colInfo.ts_type = "string"; + break; + case "varchar": + colInfo.ts_type = "string"; + colInfo.char_max_lenght = + resp.CHARACTER_MAXIMUM_LENGTH > 0 + ? resp.CHARACTER_MAXIMUM_LENGTH + : null; + break; case "blob": colInfo.ts_type = "Buffer"; break; + case "text": + colInfo.ts_type = "string"; + break; case "tinyblob": colInfo.ts_type = "Buffer"; break; @@ -161,58 +174,42 @@ export class MysqlDriver extends AbstractDriver { case "longtext": colInfo.ts_type = "string"; break; - case "varchar": - colInfo.ts_type = "string"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "nvarchar": - colInfo.ts_type = "string"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "money": - colInfo.ts_type = "number"; - break; - case "real": - colInfo.ts_type = "number"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "double": - colInfo.ts_type = "number"; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "decimal": - colInfo.ts_type = "number"; - colInfo.numericPrecision = resp.NUMERIC_PRECISION; - colInfo.numericScale = resp.NUMERIC_SCALE; - colInfo.char_max_lenght = - resp.CHARACTER_MAXIMUM_LENGTH > 0 - ? resp.CHARACTER_MAXIMUM_LENGTH - : null; - break; - case "xml": - colInfo.ts_type = "string"; - break; - case "json": - colInfo.ts_type = "Object"; - break; case "enum": colInfo.ts_type = "string"; colInfo.enumOptions = resp.column_type .substring(5, resp.column_type.length - 1) .replace(/\'/gi, '"'); break; + case "json": + colInfo.ts_type = "Object"; + break; + case "binary": + colInfo.ts_type = "Buffer"; + break; + case "geometry": + colInfo.ts_type = "string"; + break; + case "point": + colInfo.ts_type = "string"; + break; + case "linestring": + colInfo.ts_type = "string"; + break; + case "polygon": + colInfo.ts_type = "string"; + break; + case "multipoint": + colInfo.ts_type = "string"; + break; + case "multilinestring": + colInfo.ts_type = "string"; + break; + case "multipolygon": + colInfo.ts_type = "string"; + break; + case "geometrycollection": + colInfo.ts_type = "string"; + break; default: TomgUtils.LogError( `Unknown column type: ${ diff --git a/src/drivers/PostgresDriver.ts b/src/drivers/PostgresDriver.ts index 172ee64..8930382 100644 --- a/src/drivers/PostgresDriver.ts +++ b/src/drivers/PostgresDriver.ts @@ -68,36 +68,29 @@ export class PostgresDriver extends AbstractDriver { : resp.column_default; colInfo.sql_type = resp.data_type; switch (resp.data_type) { - case "integer": + case "int2": colInfo.ts_type = "number"; break; - case "character varying": - colInfo.ts_type = "string"; - colInfo.char_max_lenght = - resp.character_maximum_length > 0 - ? resp.character_maximum_length - : null; + case "int4": + colInfo.ts_type = "number"; break; - case "text": - colInfo.ts_type = "string"; - break; - case "uuid": + case "int8": colInfo.ts_type = "string"; break; case "smallint": colInfo.ts_type = "number"; break; + case "integer": + colInfo.ts_type = "number"; + break; case "bigint": colInfo.ts_type = "string"; break; - case "date": + case "decimal": colInfo.ts_type = "string"; break; - case "boolean": - colInfo.ts_type = "boolean"; - break; - case "double precision": - colInfo.ts_type = "number"; + case "numeric": + colInfo.ts_type = "string"; colInfo.numericPrecision = resp.numeric_precision; colInfo.numericScale = resp.numeric_scale; break; @@ -106,30 +99,31 @@ export class PostgresDriver extends AbstractDriver { colInfo.numericPrecision = resp.numeric_precision; colInfo.numericScale = resp.numeric_scale; break; - case "numeric": - colInfo.ts_type = "string"; + case "float": + colInfo.ts_type = "number"; + break; + case "float4": + colInfo.ts_type = "number"; + break; + case "float8": + colInfo.ts_type = "number"; + break; + case "double precision": + colInfo.ts_type = "number"; colInfo.numericPrecision = resp.numeric_precision; colInfo.numericScale = resp.numeric_scale; break; - case "time without time zone": + case "money": colInfo.ts_type = "string"; break; - case "timestamp without time zone": - colInfo.ts_type = "Date"; + case "character varying": + colInfo.ts_type = "string"; + colInfo.char_max_lenght = + resp.character_maximum_length > 0 + ? resp.character_maximum_length + : null; break; - case "timestamp with time zone": - colInfo.ts_type = "Date"; - break; - case "timestamp with time zone": - colInfo.ts_type = "Date"; - break; - case "json": - colInfo.ts_type = "Object"; - break; - case "jsonb": - colInfo.ts_type = "Object"; - break; - case "money": + case "varchar": colInfo.ts_type = "string"; break; case "character": @@ -139,15 +133,75 @@ export class PostgresDriver extends AbstractDriver { ? resp.character_maximum_length : null; break; + case "char": + colInfo.ts_type = "string"; + colInfo.char_max_lenght = + resp.character_maximum_length > 0 + ? resp.character_maximum_length + : null; + break; + case "text": + colInfo.ts_type = "string"; + break; + case "citext": + colInfo.ts_type = "string"; + break; + case "hstore": + colInfo.ts_type = "string"; + break; case "bytea": colInfo.ts_type = "Buffer"; break; - case "interval": - colInfo.ts_type = "any"; + case "bit": + colInfo.ts_type = "string"; + break; + case "varbit": + colInfo.ts_type = "string"; + break; + case "bit varying": + colInfo.ts_type = "string"; + break; + case "timetz": + colInfo.ts_type = "string"; + break; + case "timestamptz": + colInfo.ts_type = "Date"; + break; + case "timestamp": + colInfo.ts_type = "string"; + break; + case "timestamp without time zone": + colInfo.ts_type = "Date"; + break; + case "timestamp with time zone": + colInfo.ts_type = "Date"; + break; + case "date": + colInfo.ts_type = "string"; + break; + case "time": + colInfo.ts_type = "string"; + break; + case "time without time zone": + colInfo.ts_type = "string"; break; case "time with time zone": colInfo.ts_type = "string"; break; + case "interval": + colInfo.ts_type = "any"; + break; + case "bool": + colInfo.ts_type = "boolean"; + break; + case "boolean": + colInfo.ts_type = "boolean"; + break; + /* */ + case "enum": + colInfo.ts_type = "string"; + break; + /* */ case "point": colInfo.ts_type = "string | Object"; break; @@ -178,15 +232,43 @@ export class PostgresDriver extends AbstractDriver { case "macaddr": colInfo.ts_type = "string"; break; - case "bit": + + case "tsvector": colInfo.ts_type = "string"; break; - case "bit varying": + case "tsquery": + colInfo.ts_type = "string"; + break; + case "uuid": colInfo.ts_type = "string"; break; case "xml": colInfo.ts_type = "string"; break; + case "json": + colInfo.ts_type = "Object"; + break; + case "jsonb": + colInfo.ts_type = "Object"; + break; + case "int4range": + colInfo.ts_type = "string"; + break; + case "int8range": + colInfo.ts_type = "string"; + break; + case "numrange": + colInfo.ts_type = "string"; + break; + case "tsrange": + colInfo.ts_type = "string"; + break; + case "tstzrange": + colInfo.ts_type = "string"; + break; + case "daterange": + colInfo.ts_type = "string"; + break; default: TomgUtils.LogError( `Unknown column type: ${ diff --git a/test/integration/entityTypes/mariadb/entity/Post.ts b/test/integration/entityTypes/mariadb/entity/Post.ts index 7f53133..142c281 100644 --- a/test/integration/entityTypes/mariadb/entity/Post.ts +++ b/test/integration/entityTypes/mariadb/entity/Post.ts @@ -15,6 +15,9 @@ export class Post { @Column("tinyint") tinyint: number; + @Column("tinyint",{width:1}) + boolean: boolean; + @Column("smallint") smallint: number; @@ -22,7 +25,7 @@ export class Post { mediumint: number; @Column("bigint") - bigint: number; + bigint: string; @Column("float") float: number; @@ -31,7 +34,7 @@ export class Post { double: number; @Column("decimal") - decimal: number; + decimal: string; @Column("date") date: string; @@ -81,19 +84,35 @@ export class Post { @Column("enum", { enum: ["A", "B", "C"] }) enum: string; - // @Column("enum", { enum: FruitEnum }) - // classEnum1: FruitEnum; - - //MariaDb type for Json - LONGTEXT + // In mariaDb Json is recognized as longtext // @Column("json") // json: Object; - // @Column("simple-array") - // simpleArray: string[]; + @Column("binary") + binary: Buffer; + @Column("geometry") + geometry: string; + @Column("point") + point: string; - @Column("tinyint",{width:1}) - bool: boolean; + @Column("linestring") + linestring: string; + + @Column("polygon") + polygon: string; + + @Column("multipoint") + multipoint: string; + + @Column("multilinestring") + multilinestring: string; + + @Column("multipolygon") + multipolygon: string; + + @Column("geometrycollection") + geometrycollection: string; } diff --git a/test/integration/entityTypes/mssql/entity/Post.ts b/test/integration/entityTypes/mssql/entity/Post.ts index 923be11..dc00e73 100644 --- a/test/integration/entityTypes/mssql/entity/Post.ts +++ b/test/integration/entityTypes/mssql/entity/Post.ts @@ -9,95 +9,50 @@ export class Post { @Column() name: string; - // ------------------------------------------------------------------------- - // Numeric Types - // ------------------------------------------------------------------------- + @Column("bigint") + bigint: string; @Column("bit") bit: boolean; - @Column("tinyint") - tinyint: number; - - @Column("smallint") - smallint: number; + @Column("decimal") + decimal: number; @Column("int") int: number; - @Column("bigint") - bigint: string; - - @Column("decimal") - decimal: number; - - @Column("dec") - dec: number; + @Column("money") + money: number; @Column("numeric") numeric: number; + @Column("smallint") + smallint: number; + + @Column("smallmoney") + smallmoney: number; + + @Column("tinyint") + tinyint: number; + @Column("float") float: number; @Column("real") real: number; - @Column("smallmoney") - smallmoney: number; - - @Column("money") - money: number; - - // ------------------------------------------------------------------------- - // Character Types - // ------------------------------------------------------------------------- - - @Column("uniqueidentifier") - uniqueidentifier: string; - - @Column("char") - char: string; - - @Column("varchar") - varchar: string; - - @Column("text") - text: string; - - @Column("nchar") - nchar: string; - - @Column("nvarchar") - nvarchar: string; - - @Column("ntext") - ntext: string; - - @Column("binary") - binary: Buffer; - - @Column("varbinary") - varbinary: Buffer; - - @Column("image") - image: Buffer; - - // ------------------------------------------------------------------------- - // Date Types - // ------------------------------------------------------------------------- - @Column("date") dateObj: Date; - // @Column("date") - // date: string; + @Column("datetime2") + datetime2: Date; @Column("datetime") datetime: Date; - @Column("datetime2") - datetime2: Date; + @Column("datetimeoffset") + datetimeoffset: Date; @Column("smalldatetime") smalldatetime: Date; @@ -105,20 +60,52 @@ export class Post { @Column("time") timeObj: Date; + @Column("char") + char: string; + + @Column("text") + text: string; + + @Column("varchar") + varchar: string; + + @Column("nchar") + nchar: string; + + @Column("ntext") + ntext: string; + + @Column("nvarchar") + nvarchar: string; + + @Column("binary") + binary: Buffer; + + @Column("image") + image: Buffer; + + @Column("varbinary") + varbinary: Buffer; + + @Column("hierarchyid") + hierarchyid: string; + + @Column("sql_variant") + sql_variant: string; + @Column("timestamp") timestamp: Date; - // @Column("time") - // time: string; + @Column("uniqueidentifier") + uniqueidentifier: string; - @Column("datetimeoffset") - datetimeoffset: Date; + @Column("xml") + xml: string; - // ------------------------------------------------------------------------- - // TypeOrm Specific Type - // ------------------------------------------------------------------------- + @Column("geometry") + geometry: string; - // @Column("simple-array") - // simpleArray: string[]; + @Column("geography") + geography: string; } diff --git a/test/integration/entityTypes/mysql/entity/Post.ts b/test/integration/entityTypes/mysql/entity/Post.ts index 96524e4..707ea9e 100644 --- a/test/integration/entityTypes/mysql/entity/Post.ts +++ b/test/integration/entityTypes/mysql/entity/Post.ts @@ -15,6 +15,9 @@ export class Post { @Column("tinyint") tinyint: number; + @Column("tinyint",{width:1}) + boolean: boolean; + @Column("smallint") smallint: number; @@ -22,7 +25,7 @@ export class Post { mediumint: number; @Column("bigint") - bigint: number; + bigint: string; @Column("float") float: number; @@ -31,7 +34,7 @@ export class Post { double: number; @Column("decimal") - decimal: number; + decimal: string; @Column("date") date: string; @@ -81,19 +84,34 @@ export class Post { @Column("enum", { enum: ["A", "B", "C"] }) enum: string; - // @Column("enum", { enum: FruitEnum }) - // classEnum1: FruitEnum; - @Column("json") json: Object; - // @Column("simple-array") - // simpleArray: string[]; + @Column("binary") + binary: Buffer; + @Column("geometry") + geometry: string; + @Column("point") + point: string; + @Column("linestring") + linestring: string; - @Column("tinyint",{width:1}) - bool: boolean; + @Column("polygon") + polygon: string; + + @Column("multipoint") + multipoint: string; + + @Column("multilinestring") + multilinestring: string; + + @Column("multipolygon") + multipolygon: string; + + @Column("geometrycollection") + geometrycollection: string; } diff --git a/test/integration/entityTypes/postgres/entity/Post.ts b/test/integration/entityTypes/postgres/entity/Post.ts index fb81185..03e2075 100644 --- a/test/integration/entityTypes/postgres/entity/Post.ts +++ b/test/integration/entityTypes/postgres/entity/Post.ts @@ -9,89 +9,59 @@ export class Post { @Column() name: string; - // ------------------------------------------------------------------------- - // Numeric Types - // ------------------------------------------------------------------------- - - @Column("integer") - integer: number; + @Column("int2") + int2: number; @Column("int4") int4: number; - @Column("int") - int: number; + @Column("int8") + int8: string; @Column("smallint") smallint: number; - @Column("int2") - int2: number; + @Column("integer") + integer: number; @Column("bigint") bigint: string; - @Column("int8") - int8: string; - - // @Column("serial") - // serial: number; - - // @Column("serial4") - // serial4: number; - - // @Column("smallserial") - // smallserial: number; - - // @Column("serial2") - // serial2: number; - - // @Column("bigserial") - // bigserial: number; - - // @Column("serial8") - // serial8: number; + @Column("decimal") + decimal: string; @Column("numeric") numeric: string; - @Column("decimal") - decimal: string; - - @Column("double precision") - doublePrecision: number; - - @Column("float8") - float8: number; - @Column("real") real: number; + @Column("float") + float: number; + @Column("float4") float4: number; - // ------------------------------------------------------------------------- - // Monetary Types - // ------------------------------------------------------------------------- + @Column("float8") + float8: number; + + @Column("double precision") + doublePrecision: number; @Column("money") money: string; - // ------------------------------------------------------------------------- - // Character Types - // ------------------------------------------------------------------------- - - @Column("char") - char: string; - - @Column("character") - character: string; + @Column("character varying") + characterVarying: string; @Column("varchar") varchar: string; - @Column("character varying") - characterVarying: string; + @Column("character") + character: string; + + @Column("char") + char: string; @Column("text") text: string; @@ -99,62 +69,59 @@ export class Post { // @Column("citext") // citext: string; - // ------------------------------------------------------------------------- - // Binary Data Types - // ------------------------------------------------------------------------- + // @Column("hstore") + // hstore: string; @Column("bytea") bytea: Buffer; - // ------------------------------------------------------------------------- - // Date/Time Types - // ------------------------------------------------------------------------- + @Column("bit") + bit: string; - @Column("date") - date: string; + @Column("varbit") + varbit: string; - @Column("interval") - interval: any; - - @Column("time") - time: string; - - @Column("time with time zone") - timeWithTimeZone: string; + @Column("bit varying") + bit_varying: string; @Column("timetz") timetz: string; - @Column("timestamp") - timestamp: Date; - - @Column("timestamp with time zone") - timestampWithTimeZone: Date; - @Column("timestamptz") timestamptz: Date; - // ------------------------------------------------------------------------- - // Boolean Type - // ------------------------------------------------------------------------- + @Column("timestamp") + timestamp: Date; - @Column("boolean") - boolean: boolean; + @Column("timestamp without time zone") + timestamp_without_time_zone: Date; + + @Column("timestamp with time zone") + timestamp_with_time_zone: Date; + + @Column("date") + date: string; + + @Column("time") + time: string; + @Column("time without time zone") + time_without_time_zone: string; + + @Column("time with time zone") + time_with_time_zone: string; + + @Column("interval") + interval: any; @Column("bool") bool: boolean; - // ------------------------------------------------------------------------- - // Enumerated Type - // ------------------------------------------------------------------------- + @Column("boolean") + boolean: boolean; - // @Column("enum", { enum: ["A", "B", "C"] }) + // @Column("enum") // enum: string; - // ------------------------------------------------------------------------- - // Geometric Type - // ------------------------------------------------------------------------- - @Column("point") point: string | Object; @@ -176,10 +143,6 @@ export class Post { @Column("circle") circle: string | Object; - // ------------------------------------------------------------------------- - // Network Address Type - // ------------------------------------------------------------------------- - @Column("cidr") cidr: string; @@ -189,52 +152,40 @@ export class Post { @Column("macaddr") macaddr: string; - // ------------------------------------------------------------------------- - // Bit String Type - // ------------------------------------------------------------------------- + @Column("tsvector") + tsvector: string; - @Column("bit") - bit: string; - - @Column("varbit") - varbit: string; - - @Column("bit varying") - bitVarying: string; - - // ------------------------------------------------------------------------- - // UUID Type - // ------------------------------------------------------------------------- + @Column("tsquery") + tsquery: string; @Column("uuid") uuid: string; - // ------------------------------------------------------------------------- - // XML Type - // ------------------------------------------------------------------------- - @Column("xml") xml: string; - // ------------------------------------------------------------------------- - // JSON Type - // ------------------------------------------------------------------------- - @Column("json") json: Object; - // ------------------------------------------------------------------------- - // Array Type - // ------------------------------------------------------------------------- + @Column("jsonb") + jsonb: Object; - // @Column("int", { isArray: true }) - // array: number[]; + @Column("int4range") + int4range: string; - // // ------------------------------------------------------------------------- - // // TypeOrm Specific Type - // // ------------------------------------------------------------------------- + @Column("int8range") + int8range: string; - // @Column("simple-array") - // simpleArray: string[]; + @Column("numrange") + numrange: string; + + @Column("tsrange") + tsrange: string; + + @Column("tstzrange") + tstzrange: string; + + @Column("daterange") + daterange: string; }