@axiosleo/orm-mysql 0.9.7 → 0.9.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/bin/orm-mysql.js +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/builder.js +6 -14
package/bin/orm-mysql.js
CHANGED
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/builder.js
CHANGED
|
@@ -150,6 +150,7 @@ class Builder {
|
|
|
150
150
|
table = `\`${table}\``;
|
|
151
151
|
}
|
|
152
152
|
let sql = '';
|
|
153
|
+
join_type = join_type.toLowerCase();
|
|
153
154
|
switch (join_type) {
|
|
154
155
|
case 'left':
|
|
155
156
|
sql = 'LEFT JOIN ';
|
|
@@ -386,20 +387,9 @@ class ManageSQLBuilder extends Builder {
|
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
createColumn(options) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
type: 'required|string',
|
|
393
|
-
length: 'integer',
|
|
394
|
-
unsigned: 'boolean',
|
|
395
|
-
allowNull: 'boolean',
|
|
396
|
-
default: 'string',
|
|
397
|
-
comment: 'string',
|
|
398
|
-
autoIncrement: 'boolean',
|
|
399
|
-
primaryKey: 'boolean',
|
|
400
|
-
uniqIndex: 'boolean',
|
|
401
|
-
after: 'string'
|
|
402
|
-
});
|
|
390
|
+
if (!options.table) {
|
|
391
|
+
throw new Error('Table name is required');
|
|
392
|
+
}
|
|
403
393
|
return `ALTER TABLE \`${options.table}\` ADD COLUMN ` + this.renderSingleColumn(options);
|
|
404
394
|
}
|
|
405
395
|
|
|
@@ -430,6 +420,8 @@ class ManageSQLBuilder extends Builder {
|
|
|
430
420
|
}
|
|
431
421
|
|
|
432
422
|
createForeignKey(options) {
|
|
423
|
+
options.reference.onDelete = options.reference.onDelete ? options.reference.onDelete.toUpperCase() : 'NO ACTION';
|
|
424
|
+
options.reference.onUpdate = options.reference.onUpdate ? options.reference.onUpdate.toUpperCase() : 'NO ACTION';
|
|
433
425
|
_validate(options, {
|
|
434
426
|
name: 'required|string',
|
|
435
427
|
table: 'required|string',
|