fix(Postgres Node): Connection pool of the database object has been destroyed (#7074)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Michael Kret
2023-09-01 22:19:10 +03:00
committed by GitHub
parent 008cdcce56
commit 9dd5f0e579
10 changed files with 83 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ export type ColumnInfo = {
column_name: string;
data_type: string;
is_nullable: string;
udt_name: string;
udt_name?: string;
column_default?: string;
};
export type EnumInfo = {

View File

@@ -458,3 +458,16 @@ export function checkItemAgainstSchema(
return item;
}
export const configureTableSchemaUpdater = (initialSchema: string, initialTable: string) => {
let currentSchema = initialSchema;
let currentTable = initialTable;
return async (db: PgpDatabase, tableSchema: ColumnInfo[], schema: string, table: string) => {
if (currentSchema !== schema || currentTable !== table) {
currentSchema = schema;
currentTable = table;
tableSchema = await getTableSchema(db, schema, table);
}
return tableSchema;
};
};