@mikro-orm/knex 6.1.13-dev.38 → 6.1.13-dev.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.
|
@@ -61,7 +61,7 @@ class MySqlSchemaHelper extends SchemaHelper_1.SchemaHelper {
|
|
|
61
61
|
primary: index.index_name === 'PRIMARY',
|
|
62
62
|
constraint: !index.non_unique,
|
|
63
63
|
};
|
|
64
|
-
if (!index.column_name || index.
|
|
64
|
+
if (!index.column_name || index.expression?.match(/ where /i)) {
|
|
65
65
|
indexDef.expression = index.expression; // required for the `getCreateIndexSQL()` call
|
|
66
66
|
indexDef.expression = this.getCreateIndexSQL(index.table_name, indexDef, !!index.expression);
|
|
67
67
|
}
|
|
@@ -100,7 +100,7 @@ class MySqlSchemaHelper extends SchemaHelper_1.SchemaHelper {
|
|
|
100
100
|
? ['false', 'true'][+col.column_default]
|
|
101
101
|
: col.column_default, col.length));
|
|
102
102
|
const key = this.getTableKey(col);
|
|
103
|
-
const generated = col.generation_expression ?
|
|
103
|
+
const generated = col.generation_expression ? `(${col.generation_expression.replaceAll(`\\'`, `'`)}) ${col.extra.match(/stored generated/i) ? 'stored' : 'virtual'}` : undefined;
|
|
104
104
|
ret[key] ??= [];
|
|
105
105
|
ret[key].push({
|
|
106
106
|
name: col.column_name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.1.13-dev.
|
|
3
|
+
"version": "6.1.13-dev.39",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.1.12"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.1.13-dev.
|
|
69
|
+
"@mikro-orm/core": "6.1.13-dev.39"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/schema/DatabaseTable.js
CHANGED
|
@@ -169,8 +169,7 @@ class DatabaseTable {
|
|
|
169
169
|
}
|
|
170
170
|
getEntityDeclaration(namingStrategy, schemaHelper, scalarPropertiesForRelations) {
|
|
171
171
|
const { fksOnColumnProps, fksOnStandaloneProps, columnFks, fkIndexes, nullableForeignKeys, skippedColumnNames, } = this.foreignKeysToProps(namingStrategy, scalarPropertiesForRelations);
|
|
172
|
-
|
|
173
|
-
name = name.match(/^\d/) ? 'E' + name : name;
|
|
172
|
+
const name = namingStrategy.getEntityName(this.name, this.schema);
|
|
174
173
|
const schema = new core_1.EntitySchema({ name, collection: this.name, schema: this.schema });
|
|
175
174
|
const compositeFkIndexes = {};
|
|
176
175
|
const compositeFkUniques = {};
|
|
@@ -481,7 +481,7 @@ class SchemaComparator {
|
|
|
481
481
|
diffExpression(expr1, expr2) {
|
|
482
482
|
// expressions like check constraints might be normalized by the driver,
|
|
483
483
|
// e.g. quotes might be added (https://github.com/mikro-orm/mikro-orm/issues/3827)
|
|
484
|
-
const simplify = (str) => str?.replace(/_\w
|
|
484
|
+
const simplify = (str) => str?.replace(/_\w+'(.*?)'/g, '$1').replace(/['"`()]|::\w+| +/g, '').toLowerCase();
|
|
485
485
|
return simplify(expr1) !== simplify(expr2);
|
|
486
486
|
}
|
|
487
487
|
parseJsonDefault(defaultValue) {
|