Skip to content

Commit 244aa83

Browse files
HCK-9149: postgres -> polyglot mapping (#133)
* fix: convert vectors into `vector<real` for "to polyglot" * fix: allow vector types to be used in custom schemas
1 parent c8fc70e commit 244aa83

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

forward_engineering/ddlProvider/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
createDatabase:
33
'CREATE DATABASE ${name}${template}${encoding}${locale}${collate}${characterClassification}${tablespace};\n',
44

5-
createSchema: 'CREATE SCHEMA${ifNotExist} ${name};\nSET search_path TO ${name};\n\n${comment}\n',
5+
createSchema: 'CREATE SCHEMA${ifNotExist} ${name};\nSET search_path TO ${name}, public;\n\n${comment}\n',
66

77
comment: 'COMMENT ON ${object} ${objectName} IS ${comment};\n',
88

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@
8888
"lodash": "4.17.21",
8989
"pg": "8.12.0"
9090
}
91-
}
91+
}

polyglot/convertAdapter.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747
"type": "vector"
4848
},
4949
"to": {
50-
"to": "vector",
51-
"subtype": ""
50+
"subtype": "vector<real>"
5251
}
5352
}
5453
]

reverse_engineering/helpers/connectionHelper.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,24 @@ const retryOnSslError = (config, logger, error) => {
135135
throw error;
136136
};
137137

138-
const createConnectionPool = (config, logger) => {
138+
const createConnectionPool = async (config, logger) => {
139139
const pool = new pg.Pool(config);
140140

141-
return pool
142-
.connect()
143-
.then(client => {
144-
client.release();
141+
try {
142+
const client = await pool.connect();
145143

146-
return pool;
147-
})
148-
.catch(async error => {
149-
await pool.end();
144+
client.release();
150145

151-
if (config.isRetry) {
152-
throw error;
153-
}
146+
return pool;
147+
} catch (error) {
148+
await pool.end();
154149

155-
return retryOnSslError(config, logger, error);
156-
});
150+
if (config.isRetry) {
151+
throw error;
152+
}
153+
154+
return retryOnSslError(config, logger, error);
155+
}
157156
};
158157

159158
module.exports = {

0 commit comments

Comments
 (0)