@oino-ts/db-mariadb 1.1.2 → 1.1.3
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.
|
@@ -407,7 +407,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
407
407
|
isAutoInc: extra.indexOf('auto_increment') >= 0,
|
|
408
408
|
isNotNull: row[2] == "NO"
|
|
409
409
|
};
|
|
410
|
-
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "float") || (sql_type == "double")) {
|
|
410
|
+
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "mediumint") || (sql_type == "bigint") || (sql_type == "float") || (sql_type == "double")) {
|
|
411
411
|
fields.push(new common_2.OINONumberDataField(this, field_name, sql_type, field_params));
|
|
412
412
|
}
|
|
413
413
|
else if ((sql_type == "date") || (sql_type == "datetime") || (sql_type == "timestamp")) {
|
|
@@ -466,7 +466,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
466
466
|
case "string":
|
|
467
467
|
return (schema.maxLength || 0) > 0 ? "varchar(" + schema.maxLength + ")" : "longtext";
|
|
468
468
|
case "number":
|
|
469
|
-
return "double";
|
|
469
|
+
return schema.fieldParams?.isAutoInc ? "bigint" : "double";
|
|
470
470
|
case "boolean":
|
|
471
471
|
return "bit(1)";
|
|
472
472
|
case "datetime":
|
|
@@ -477,5 +477,8 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
477
477
|
throw new Error(common_1.OINO_ERROR_PREFIX + ": OINODbMariadb.getNativeDataType - unsupported field type '" + schema.type + "'");
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
+
_printColumnAutoInc() {
|
|
481
|
+
return "AUTO_INCREMENT";
|
|
482
|
+
}
|
|
480
483
|
}
|
|
481
484
|
exports.OINODbMariadb = OINODbMariadb;
|
|
@@ -404,7 +404,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
404
404
|
isAutoInc: extra.indexOf('auto_increment') >= 0,
|
|
405
405
|
isNotNull: row[2] == "NO"
|
|
406
406
|
};
|
|
407
|
-
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "float") || (sql_type == "double")) {
|
|
407
|
+
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "mediumint") || (sql_type == "bigint") || (sql_type == "float") || (sql_type == "double")) {
|
|
408
408
|
fields.push(new OINONumberDataField(this, field_name, sql_type, field_params));
|
|
409
409
|
}
|
|
410
410
|
else if ((sql_type == "date") || (sql_type == "datetime") || (sql_type == "timestamp")) {
|
|
@@ -463,7 +463,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
463
463
|
case "string":
|
|
464
464
|
return (schema.maxLength || 0) > 0 ? "varchar(" + schema.maxLength + ")" : "longtext";
|
|
465
465
|
case "number":
|
|
466
|
-
return "double";
|
|
466
|
+
return schema.fieldParams?.isAutoInc ? "bigint" : "double";
|
|
467
467
|
case "boolean":
|
|
468
468
|
return "bit(1)";
|
|
469
469
|
case "datetime":
|
|
@@ -474,4 +474,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`;
|
|
|
474
474
|
throw new Error(OINO_ERROR_PREFIX + ": OINODbMariadb.getNativeDataType - unsupported field type '" + schema.type + "'");
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
+
_printColumnAutoInc() {
|
|
478
|
+
return "AUTO_INCREMENT";
|
|
479
|
+
}
|
|
477
480
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/db-mariadb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "OINO TS package for using Mariadb databases.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"module": "./dist/esm/index.js",
|
|
22
22
|
"types": "./dist/types/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@oino-ts/common": "^1.1.
|
|
25
|
-
"@oino-ts/db": "^1.1.
|
|
24
|
+
"@oino-ts/common": "^1.1.3",
|
|
25
|
+
"@oino-ts/db": "^1.1.3",
|
|
26
26
|
"mariadb": "^3.2.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/bun": "^1.1.
|
|
29
|
+
"@types/bun": "^1.1.34",
|
|
30
30
|
"@types/node": "^20.12.7",
|
|
31
31
|
"typescript": "~5.9.0"
|
|
32
32
|
},
|
package/src/OINODbMariadb.ts
CHANGED
|
@@ -434,7 +434,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`
|
|
|
434
434
|
isAutoInc: extra.indexOf('auto_increment') >= 0,
|
|
435
435
|
isNotNull: row[2] == "NO"
|
|
436
436
|
}
|
|
437
|
-
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "float") || (sql_type == "double")) {
|
|
437
|
+
if ((sql_type == "int") || (sql_type == "smallint") || (sql_type == "mediumint") || (sql_type == "bigint") || (sql_type == "float") || (sql_type == "double")) {
|
|
438
438
|
fields.push(new OINONumberDataField(this, field_name, sql_type, field_params))
|
|
439
439
|
} else if ((sql_type == "date") || (sql_type == "datetime") || (sql_type == "timestamp")) {
|
|
440
440
|
fields.push(new OINODatetimeDataField(this, field_name, sql_type, field_params))
|
|
@@ -488,7 +488,7 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`
|
|
|
488
488
|
case "string":
|
|
489
489
|
return (schema.maxLength || 0) > 0 ? "varchar(" + schema.maxLength + ")" : "longtext"
|
|
490
490
|
case "number":
|
|
491
|
-
return "double"
|
|
491
|
+
return schema.fieldParams?.isAutoInc ? "bigint" : "double"
|
|
492
492
|
case "boolean":
|
|
493
493
|
return "bit(1)"
|
|
494
494
|
case "datetime":
|
|
@@ -499,6 +499,10 @@ WHERE C.TABLE_SCHEMA = '${dbName}';`
|
|
|
499
499
|
throw new Error(OINO_ERROR_PREFIX + ": OINODbMariadb.getNativeDataType - unsupported field type '" + schema.type + "'")
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
+
|
|
503
|
+
protected _printColumnAutoInc(): string {
|
|
504
|
+
return "AUTO_INCREMENT"
|
|
505
|
+
}
|
|
502
506
|
}
|
|
503
507
|
|
|
504
508
|
|