feat: Add option schemaCacheTtl for schema cache pulling as alternative to enableSchemaHooks (#8436)

This commit is contained in:
Daniel
2023-02-27 11:55:47 +11:00
committed by GitHub
parent bdca9f4ce3
commit b3b76de71b
10 changed files with 150 additions and 26 deletions

View File

@@ -850,13 +850,18 @@ export class PostgresStorageAdapter implements StorageAdapter {
_pgp: any;
_stream: any;
_uuid: any;
schemaCacheTtl: ?number;
constructor({ uri, collectionPrefix = '', databaseOptions = {} }: any) {
const options = { ...databaseOptions };
this._collectionPrefix = collectionPrefix;
this.enableSchemaHooks = !!databaseOptions.enableSchemaHooks;
delete databaseOptions.enableSchemaHooks;
this.schemaCacheTtl = databaseOptions.schemaCacheTtl;
for (const key of ['enableSchemaHooks', 'schemaCacheTtl']) {
delete options[key];
}
const { client, pgp } = createClient(uri, databaseOptions);
const { client, pgp } = createClient(uri, options);
this._client = client;
this._onchange = () => {};
this._pgp = pgp;