Skip to content

Commit 3354a5b

Browse files
authored
explicitly handle version 15 and 16 and update latest version (#117)
1 parent f081aa9 commit 3354a5b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

properties_pane/defaultData.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"model": {
33
"modelName": "New model",
4-
"dbVersion": "v15.x",
4+
"dbVersion": "v16.x",
55
"dbVendor": "PostgreSQL"
66
},
77
"container": {

reverse_engineering/helpers/postgresService.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const { mapSequenceData } = require('./postgresHelpers/sequenceHelper');
5151
let useSshTunnel = false;
5252
let _ = null;
5353
let logger = null;
54-
let version = 14;
54+
let version = 16;
5555

5656
module.exports = {
5757
setDependencies(app) {
@@ -102,9 +102,9 @@ module.exports = {
102102

103103
async logVersion() {
104104
const versionRow = await db.queryTolerant(queryConstants.GET_VERSION, [], true);
105-
const version = versionRow?.version || 'Version not retrieved';
105+
const serverVersion = versionRow?.version || 'Version not retrieved';
106106

107-
logger.info(`PostgreSQL version: ${version}`);
107+
logger.info(`PostgreSQL version: ${serverVersion}`);
108108
},
109109

110110
async getAllSchemasNames() {
@@ -135,12 +135,14 @@ module.exports = {
135135
const database_name = (await db.queryTolerant(queryConstants.GET_DB_NAME, [], true))?.current_database;
136136
const encoding = (await db.queryTolerant(queryConstants.GET_DB_ENCODING, [], true))?.server_encoding;
137137
const LC_COLLATE = (await db.queryTolerant(queryConstants.GET_DB_COLLATE_NAME, [], true))?.default_collate_name;
138+
const dbVersion = `v${await this._getServerVersion()}.x`;
138139

139140
return clearEmptyPropertiesInObject({
140141
database_name,
141142
encoding,
142143
LC_COLLATE,
143144
LC_CTYPE: LC_COLLATE,
145+
dbVersion,
144146
});
145147
},
146148

@@ -441,6 +443,7 @@ module.exports = {
441443
async _getServerVersion() {
442444
const result = await db.queryTolerant(queryConstants.GET_VERSION_AS_NUM, [], true);
443445
const serverVersionNum = _.toNumber(result?.server_version_num);
446+
const latestPgVersion = 16;
444447

445448
if (serverVersionNum >= 100000 && serverVersionNum < 110000) {
446449
return 10;
@@ -452,9 +455,13 @@ module.exports = {
452455
return 13;
453456
} else if (serverVersionNum >= 140000 && serverVersionNum < 150000) {
454457
return 14;
458+
} else if (serverVersionNum >= 150000 && serverVersionNum < 160000) {
459+
return 15;
460+
} else if (serverVersionNum >= 160000 && serverVersionNum < 170000) {
461+
return 16;
455462
}
456463

457-
return 14;
464+
return latestPgVersion;
458465
},
459466
};
460467

0 commit comments

Comments
 (0)