masterrecord 0.3.44 → 0.3.46
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/Migrations/schema.js +2 -0
- package/context.js +4 -0
- package/mySQLEngine.js +8 -0
- package/package.json +1 -1
- package/postgresEngine.js +8 -0
package/Migrations/schema.js
CHANGED
|
@@ -16,6 +16,7 @@ class schema{
|
|
|
16
16
|
* create the database first, then retry the connection.
|
|
17
17
|
*/
|
|
18
18
|
async _ensureReady(){
|
|
19
|
+
if(this._ready){ return; }
|
|
19
20
|
if(this.context && this.context._initPromise){
|
|
20
21
|
try{
|
|
21
22
|
await this.context._initPromise;
|
|
@@ -35,6 +36,7 @@ class schema{
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
this._ready = true;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/**
|
package/context.js
CHANGED
|
@@ -721,6 +721,8 @@ class context {
|
|
|
721
721
|
// Note: engine is already set in __mysqlInit
|
|
722
722
|
return this;
|
|
723
723
|
})();
|
|
724
|
+
// Prevent unhandled rejection crash — _ensureReady() will handle errors
|
|
725
|
+
this._initPromise.catch(() => {});
|
|
724
726
|
return this._initPromise;
|
|
725
727
|
}
|
|
726
728
|
|
|
@@ -740,6 +742,8 @@ class context {
|
|
|
740
742
|
// Note: engine is already set in __postgresInit
|
|
741
743
|
return this;
|
|
742
744
|
})();
|
|
745
|
+
// Prevent unhandled rejection crash — _ensureReady() will handle errors
|
|
746
|
+
this._initPromise.catch(() => {});
|
|
743
747
|
return this._initPromise;
|
|
744
748
|
}
|
|
745
749
|
|
package/mySQLEngine.js
CHANGED
|
@@ -798,6 +798,14 @@ class MySQLEngine {
|
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
|
|
801
|
+
/**
|
|
802
|
+
* Execute raw SQL (DDL statements like CREATE TABLE, ALTER TABLE, etc.)
|
|
803
|
+
* Used by migration schema for non-parameterized DDL queries.
|
|
804
|
+
*/
|
|
805
|
+
_execute(query) {
|
|
806
|
+
return this._runWithParams(query, []);
|
|
807
|
+
}
|
|
808
|
+
|
|
801
809
|
/**
|
|
802
810
|
* Execute parameterized query with mysql2/promise
|
|
803
811
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "masterrecord",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
|
|
5
5
|
"main": "MasterRecord.js",
|
|
6
6
|
"bin": {
|
package/postgresEngine.js
CHANGED
|
@@ -750,6 +750,14 @@ class postgresEngine {
|
|
|
750
750
|
/**
|
|
751
751
|
* Execute parameterized query with pg library
|
|
752
752
|
*/
|
|
753
|
+
/**
|
|
754
|
+
* Execute raw SQL (DDL statements like CREATE TABLE, ALTER TABLE, etc.)
|
|
755
|
+
* Used by migration schema for non-parameterized DDL queries.
|
|
756
|
+
*/
|
|
757
|
+
_execute(query) {
|
|
758
|
+
return this._runWithParams(query, []);
|
|
759
|
+
}
|
|
760
|
+
|
|
753
761
|
async _runWithParams(query, params = []) {
|
|
754
762
|
try {
|
|
755
763
|
if (process.env.LOG_SQL === 'true' || process.env.NODE_ENV !== 'production') {
|