jettypod 4.4.38 → 4.4.39
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/lib/database.js +6 -1
- package/package.json +1 -1
package/lib/database.js
CHANGED
|
@@ -272,7 +272,12 @@ function validateSchema(database) {
|
|
|
272
272
|
* Close database connection
|
|
273
273
|
* @returns {Promise<void>} Resolves when database is closed
|
|
274
274
|
*/
|
|
275
|
-
function closeDb() {
|
|
275
|
+
async function closeDb() {
|
|
276
|
+
// Wait for any pending migrations before closing
|
|
277
|
+
if (migrationPromise) {
|
|
278
|
+
try { await migrationPromise; } catch { /* ignore migration errors on close */ }
|
|
279
|
+
}
|
|
280
|
+
|
|
276
281
|
return new Promise((resolve) => {
|
|
277
282
|
// Guard against concurrent close attempts
|
|
278
283
|
if (isClosing || !db) {
|