opacacms 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,11 +76,22 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
76
76
|
dialect: new PostgresDialect({
|
|
77
77
|
pool: {
|
|
78
78
|
connect: async () => {
|
|
79
|
+
const conn = await this._rawDb.reserve();
|
|
79
80
|
const query = async (sqlStr, parameters) => {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
try {
|
|
82
|
+
const res = await conn.unsafe(sqlStr, parameters || []);
|
|
83
|
+
return { rows: res };
|
|
84
|
+
} catch (e) {
|
|
85
|
+
const wrapped = new Error(e.message);
|
|
86
|
+
wrapped.code = e.code;
|
|
87
|
+
wrapped.detail = e.detail;
|
|
88
|
+
wrapped.hint = e.hint;
|
|
89
|
+
wrapped.position = e.position;
|
|
90
|
+
wrapped.stack = e.stack;
|
|
91
|
+
throw wrapped;
|
|
92
|
+
}
|
|
82
93
|
};
|
|
83
|
-
return { query, release: () =>
|
|
94
|
+
return { query, release: () => conn.release() };
|
|
84
95
|
},
|
|
85
96
|
end: async () => {},
|
|
86
97
|
on: () => {}
|
|
@@ -184,12 +195,11 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
184
195
|
const unflattened = unflattenRow(row);
|
|
185
196
|
const colDef = this._collections.find((c) => c.slug === collection);
|
|
186
197
|
if (colDef) {
|
|
187
|
-
const
|
|
188
|
-
const relationalFields = getRelationalFields2(colDef.fields);
|
|
198
|
+
const relationalFields = getRelationalFields(colDef.fields);
|
|
189
199
|
for (const field of relationalFields) {
|
|
190
200
|
if (!field.name)
|
|
191
201
|
continue;
|
|
192
|
-
const snakeName =
|
|
202
|
+
const snakeName = toSnakeCase(field.name);
|
|
193
203
|
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
194
204
|
const joinTableName = `${collection}_${snakeName}_relations`.toLowerCase();
|
|
195
205
|
try {
|
package/dist/db/index.js
CHANGED
package/dist/db/postgres.js
CHANGED