@bee.js/node 0.0.55 → 0.0.57
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.
- package/beehive.js +5 -4
- package/lib/DBA/beeDBA.js +5 -5
- package/lib/ORM/beeORM.js +4 -0
- package/package.json +1 -1
package/beehive.js
CHANGED
|
@@ -200,7 +200,8 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
200
200
|
|
|
201
201
|
await this.dbEngine()
|
|
202
202
|
|
|
203
|
-
data[mainContainer]
|
|
203
|
+
if(data[mainContainer]?.length)
|
|
204
|
+
data[mainContainer] = data[mainContainer][0]
|
|
204
205
|
|
|
205
206
|
return this
|
|
206
207
|
},
|
|
@@ -209,7 +210,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
209
210
|
|
|
210
211
|
await this.dbEngine()
|
|
211
212
|
|
|
212
|
-
if(
|
|
213
|
+
if(data[mainContainer]?.length)
|
|
213
214
|
data[mainContainer] = data[mainContainer][0]
|
|
214
215
|
|
|
215
216
|
|
|
@@ -219,7 +220,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
219
220
|
last: async function() {
|
|
220
221
|
|
|
221
222
|
await this.dbEngine()
|
|
222
|
-
|
|
223
|
+
|
|
223
224
|
data[mainContainer] = data[mainContainer][data[mainContainer].length-1]
|
|
224
225
|
|
|
225
226
|
return this
|
|
@@ -489,4 +490,4 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
489
490
|
},
|
|
490
491
|
}
|
|
491
492
|
)
|
|
492
|
-
}
|
|
493
|
+
}
|
package/lib/DBA/beeDBA.js
CHANGED
|
@@ -97,8 +97,8 @@ module.exports.actions = {
|
|
|
97
97
|
return SQL;
|
|
98
98
|
},
|
|
99
99
|
|
|
100
|
-
MODEL_CREATE_CONSTRAINT: function (model
|
|
101
|
-
|
|
100
|
+
MODEL_CREATE_CONSTRAINT: function (model) {
|
|
101
|
+
const q = beeORM.quote;
|
|
102
102
|
let SQL = "\n\n\n";
|
|
103
103
|
|
|
104
104
|
SQL += `/*----- Constraints for table ${q(model.table)} -----*/\n`;
|
|
@@ -110,9 +110,9 @@ module.exports.actions = {
|
|
|
110
110
|
}_${field}`.slice(0, 64)
|
|
111
111
|
)}
|
|
112
112
|
FOREIGN KEY (${field})
|
|
113
|
-
REFERENCES ${
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
REFERENCES ${model.relations[field].split(".")[0]} (${
|
|
114
|
+
model.relations[field].split(".")[1]
|
|
115
|
+
})
|
|
116
116
|
${"ON DELETE CASCADE"}
|
|
117
117
|
${"ON UPDATE CASCADE"};
|
|
118
118
|
\n\n`;
|
package/lib/ORM/beeORM.js
CHANGED
|
@@ -176,6 +176,10 @@ module.exports = {
|
|
|
176
176
|
waitForConnections: db.waitForConnections || true,
|
|
177
177
|
connectionLimit: db.connectionLimit || 10,
|
|
178
178
|
queueLimit: db.queueLimit || 0,
|
|
179
|
+
acquireTimeout: 10000, // Tempo limite para tentar adquirir uma nova conexão
|
|
180
|
+
connectTimeout: 10000, // Tempo limite para conectar ao banco de dados
|
|
181
|
+
idleTimeout: 60000, // Tempo que uma conexão pode ficar inativa antes de ser fechada
|
|
182
|
+
reconnect: true,
|
|
179
183
|
});
|
|
180
184
|
}
|
|
181
185
|
},
|