Skip to content

Commit 3a60dc0

Browse files
authored
Add support for migrations on Serverless v2. (#38)
Data API on v2 is more limited and does not support `char` type and caused following error: ``` UnsupportedResultException: The result contains the unsupported data type "CHAR". ``` https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#data-api.differences
1 parent 7f5ebdd commit 3a60dc0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/postgres-introspector.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export class PostgresIntrospector implements DatabaseIntrospector {
4949
"a.attnotnull as not_null",
5050
"a.atthasdef as has_default",
5151
"c.relname as table",
52-
"c.relkind as table_type",
52+
sql<string>`case when c.relkind = 'v' then true else false end`.as(
53+
"is_view"
54+
),
5355
"ns.nspname as schema",
5456
"typ.typname as type",
5557
"dtns.nspname as type_schema",
@@ -106,7 +108,7 @@ export class PostgresIntrospector implements DatabaseIntrospector {
106108
if (!table) {
107109
table = Object.freeze({
108110
name: it.table,
109-
isView: it.table_type === "v",
111+
isView: it.is_view,
110112
schema: it.schema,
111113
columns: [],
112114
});
@@ -137,7 +139,7 @@ interface RawSchemaMetadata {
137139
interface RawColumnMetadata {
138140
column: string;
139141
table: string;
140-
table_type: string;
142+
is_view: string;
141143
schema: string;
142144
not_null: boolean;
143145
has_default: boolean;

0 commit comments

Comments
 (0)