diff --git a/CHANGELOG.md b/CHANGELOG.md index f3a3b6d..08134e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## Unreleased * change default case conversions for generated files (#196) -* enum type safety #205 +* enum type safety (#205) +* postgress geography type support (#232) ## 0.3.5 diff --git a/src/drivers/PostgresDriver.ts b/src/drivers/PostgresDriver.ts index 9dbb560..2662b89 100644 --- a/src/drivers/PostgresDriver.ts +++ b/src/drivers/PostgresDriver.ts @@ -30,7 +30,8 @@ export default class PostgresDriver extends AbstractDriver { TABLE_NAME: string; DB_NAME: string; }[] = (await this.Connection.query( - `SELECT table_schema as "TABLE_SCHEMA",table_name as "TABLE_NAME", table_catalog as "DB_NAME" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND table_schema in (${schema}) ` + `SELECT table_schema as "TABLE_SCHEMA",table_name as "TABLE_NAME", table_catalog as "DB_NAME" FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_TYPE='BASE TABLE' AND table_schema in (${schema}) AND table_name<>'spatial_ref_sys'` )).rows; return response; }; @@ -370,6 +371,7 @@ WHERE "n"."nspname" = table_schema AND "t"."typname"=udt_name switch (udtName) { case "citext": case "hstore": + case "geography": case "geometry": ret.sqlType = udtName; break; diff --git a/test/integration/entityTypes/postgres/entity/Post.ts b/test/integration/entityTypes/postgres/entity/Post.ts index 1f1cc56..b715176 100644 --- a/test/integration/entityTypes/postgres/entity/Post.ts +++ b/test/integration/entityTypes/postgres/entity/Post.ts @@ -186,4 +186,7 @@ export class Post { @Column("daterange") daterange: string; + + @Column("geography") + geography: string; }