tspace-mysql 1.2.6 → 1.2.8
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/README.md +9 -1
- package/dist/lib/tspace/Model.js +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,8 @@ npm install tspace-mysql --save
|
|
|
33
33
|
- [Make Migration](#make-migration)
|
|
34
34
|
- [Migrate](#migrate)
|
|
35
35
|
- [Query](#query)
|
|
36
|
-
- [
|
|
36
|
+
- [Generate Models](#generate-models)
|
|
37
|
+
- [Dump Database](#dump-database)
|
|
37
38
|
- [Blueprint](#blueprint)
|
|
38
39
|
|
|
39
40
|
## Configuration
|
|
@@ -776,6 +777,13 @@ tspace-mysql generate:models
|
|
|
776
777
|
|
|
777
778
|
```
|
|
778
779
|
|
|
780
|
+
# Dump Database
|
|
781
|
+
Command will be dump database to .sql
|
|
782
|
+
```js
|
|
783
|
+
tspace-mysql dump:db
|
|
784
|
+
|
|
785
|
+
```
|
|
786
|
+
|
|
779
787
|
## Blueprint
|
|
780
788
|
Schema table created by command make:migration, you may use the:
|
|
781
789
|
```js
|
package/dist/lib/tspace/Model.js
CHANGED
|
@@ -2123,7 +2123,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2123
2123
|
objects = Object.assign(Object.assign({}, objects), { [updatedAt]: this.$utils.timestamp() });
|
|
2124
2124
|
}
|
|
2125
2125
|
const keyValue = Object.entries(objects).map(([column, value]) => {
|
|
2126
|
-
if (typeof value === 'string')
|
|
2126
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2127
2127
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2128
2128
|
return `${column} = ${value == null || value === 'NULL'
|
|
2129
2129
|
? 'NULL'
|
|
@@ -2148,7 +2148,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
const columns = Object.keys(objects).map((column) => `\`${column}\``);
|
|
2150
2150
|
const values = Object.values(objects).map((value) => {
|
|
2151
|
-
if (typeof value === 'string')
|
|
2151
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2152
2152
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2153
2153
|
return `${value == null || value === 'NULL'
|
|
2154
2154
|
? 'NULL'
|
|
@@ -2189,7 +2189,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2189
2189
|
];
|
|
2190
2190
|
}
|
|
2191
2191
|
const v = Object.values(objects).map((value) => {
|
|
2192
|
-
if (typeof value === 'string')
|
|
2192
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2193
2193
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2194
2194
|
return `${value == null || value === 'NULL'
|
|
2195
2195
|
? 'NULL'
|
|
@@ -2435,13 +2435,17 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2435
2435
|
case 'save': {
|
|
2436
2436
|
const methodCallings = this.$logger.get();
|
|
2437
2437
|
const methodsSomeAllowed = [
|
|
2438
|
+
"insert",
|
|
2438
2439
|
'create',
|
|
2439
2440
|
'createNotExists',
|
|
2440
2441
|
'updateOrCreate',
|
|
2441
2442
|
'updateOrInsert',
|
|
2442
2443
|
'insertOrUpdate',
|
|
2444
|
+
"createMultiple",
|
|
2445
|
+
"insertMultiple",
|
|
2443
2446
|
'update',
|
|
2444
|
-
'delete'
|
|
2447
|
+
'delete',
|
|
2448
|
+
'restore'
|
|
2445
2449
|
];
|
|
2446
2450
|
this._assertError(!methodCallings.some((methodCalling) => methodsSomeAllowed.includes(methodCalling)), `this ${method} method need some : [ ${methodsSomeAllowed.join(', ')} ] methods`);
|
|
2447
2451
|
break;
|