Skip to content

Fix #5678 #5681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions spec/features.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ describe('features', () => {
expect(data).toBeDefined();
expect(data.features).toBeDefined();
expect(data.parseServerVersion).toBeDefined();
expect(data.database).toBeDefined();
expect(['MongoDB', 'PostgreSQL']).toContain(data.database.engine);
});

it('requires the master key to get features', async done => {
Expand Down
13 changes: 1 addition & 12 deletions src/Adapters/Storage/Mongo/MongoStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ export class MongoStorageAdapter implements StorageAdapter {
client: MongoClient;
_maxTimeMS: ?number;
canSortOnJoinTables: boolean;
databaseVersion: string;
engine: string;

constructor({
uri = defaults.DefaultMongoURI,
Expand All @@ -138,7 +136,6 @@ export class MongoStorageAdapter implements StorageAdapter {
this._collectionPrefix = collectionPrefix;
this._mongoOptions = mongoOptions;
this._mongoOptions.useNewUrlParser = true;
this.engine = 'MongoDB';

// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
this._maxTimeMS = mongoOptions.maxTimeMS;
Expand Down Expand Up @@ -962,15 +959,7 @@ export class MongoStorageAdapter implements StorageAdapter {
}

performInitialization(): Promise<void> {
// databaseVersion
return this.connect()
.then(() => {
const adminDb = this.database.admin();
return adminDb.serverStatus();
})
.then(status => {
this.databaseVersion = status.version;
});
return Promise.resolve();
}

createIndex(className: string, index: any) {
Expand Down
9 changes: 0 additions & 9 deletions src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,6 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {

export class PostgresStorageAdapter implements StorageAdapter {
canSortOnJoinTables: boolean;
databaseVersion: string;
engine: string;

// Private
_collectionPrefix: string;
Expand All @@ -792,7 +790,6 @@ export class PostgresStorageAdapter implements StorageAdapter {
this._client = client;
this._pgp = pgp;
this.canSortOnJoinTables = false;
this.engine = 'PostgreSQL';
}

handleShutdown() {
Expand Down Expand Up @@ -2279,12 +2276,6 @@ 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 */
Expand Down
2 changes: 0 additions & 2 deletions src/Adapters/Storage/StorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export type FullQueryOptions = QueryOptions & UpdateQueryOptions;

export interface StorageAdapter {
canSortOnJoinTables: boolean;
databaseVersion: string;
engine: string;

classExists(className: string): Promise<boolean>;
setClassLevelPermissions(className: string, clps: any): Promise<void>;
Expand Down
5 changes: 0 additions & 5 deletions src/Routers/FeaturesRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,10 @@ export class FeaturesRouter extends PromiseRouter {
},
};

const dbAdapter = config.database.adapter;
return {
response: {
features: features,
parseServerVersion: version,
database: {
engine: dbAdapter.engine,
version: dbAdapter.databaseVersion,
},
},
};
}
Expand Down