Database version in features (#5627)

* adding database.version in the serverInfo (only MongoDB, it gives undefined when using Postgres)

* . correction of old 'features' tests
. adding engine and database in the StorageAdapter interface and implementations

* . version retrieval done in performInitialization
. PostgreSQL version

* performInitialization now returns a Promise
This commit is contained in:
Olivier Allouch
2019-06-03 23:58:21 +02:00
committed by Diamond Lewis
parent 266d6328a3
commit 7fc0d45b89
5 changed files with 61 additions and 12 deletions

View File

@@ -778,6 +778,8 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {
export class PostgresStorageAdapter implements StorageAdapter {
canSortOnJoinTables: boolean;
databaseVersion: string;
engine: string;
// Private
_collectionPrefix: string;
@@ -790,6 +792,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
this._client = client;
this._pgp = pgp;
this.canSortOnJoinTables = false;
this.engine = 'PostgreSQL';
}
handleShutdown() {
@@ -2276,6 +2279,12 @@ export class PostgresStorageAdapter implements StorageAdapter {
})
.then(data => {
debug(`initializationDone in ${data.duration}`);
// databaseVersion
return this._client.query('SHOW server_version');
})
.then(versionData => {
// versionData is like [ { server_version: '11.3' } ]
this.databaseVersion = versionData[0].server_version;
})
.catch(error => {
/* eslint-disable no-console */