#81 postgress support for citext, hstore column types

This commit is contained in:
Kononnable 2018-08-26 12:37:02 +02:00
parent d7ee4990c1
commit 76065733f7
3 changed files with 27 additions and 8 deletions

View File

@ -24,6 +24,7 @@ export class PostgresDriver extends AbstractDriver {
let response: {
table_name: string;
column_name: string;
udt_name: string;
column_default: string;
is_nullable: string;
data_type: string;
@ -33,7 +34,7 @@ export class PostgresDriver extends AbstractDriver {
isidentity: string;
isunique: number;
}[] = (await this.Connection
.query(`SELECT table_name,column_name,column_default,is_nullable,
.query(`SELECT table_name,column_name,udt_name,column_default,is_nullable,
data_type,character_maximum_length,numeric_precision,numeric_scale,
case when column_default LIKE 'nextval%' then 'YES' else 'NO' end isidentity,
(SELECT count(*)
@ -244,6 +245,27 @@ export class PostgresDriver extends AbstractDriver {
case "daterange":
colInfo.ts_type = "string";
break;
case "USER-DEFINED":
switch (resp.udt_name) {
case "citext":
colInfo.sql_type = resp.udt_name;
colInfo.ts_type = "string";
break;
case "hstore":
colInfo.sql_type = resp.udt_name;
colInfo.ts_type = "string";
break;
default:
TomgUtils.LogError(
`Unknown USER-DEFINED column type: ${
resp.udt_name
} table name: ${
resp.table_name
} column name: ${resp.column_name}`
);
break;
}
break;
default:
TomgUtils.LogError(
`Unknown column type: ${

View File

@ -66,11 +66,11 @@ export class Post {
@Column("text")
text: string;
// @Column("citext")
// citext: string;
@Column("citext")
citext: string;
// @Column("hstore")
// hstore: string;
@Column("hstore")
hstore: string;
@Column("bytea")
bytea: Buffer;

View File

@ -41,9 +41,6 @@ describe("GitHub issues", async function () {
if (dbDriver == 'mysql' || dbDriver == 'mariadb' || dbDriver == 'oracle' || dbDriver == 'sqlite')
continue;
break;
// case '71':
// xit(dbDriver);
// continue;
default:
break;
}