@mikro-orm/knex 6.3.6-dev.2 → 6.3.6-dev.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.3.6-dev.
|
|
3
|
+
"version": "6.3.6-dev.3",
|
|
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,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.3.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.3.6-dev.
|
|
69
|
+
"@mikro-orm/core": "6.3.6-dev.3",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
|
@@ -34,7 +34,7 @@ export declare class SchemaComparator {
|
|
|
34
34
|
* however ambiguities between different possibilities should not lead to renaming at all.
|
|
35
35
|
*/
|
|
36
36
|
private detectIndexRenamings;
|
|
37
|
-
diffForeignKey(key1: ForeignKey, key2: ForeignKey): boolean;
|
|
37
|
+
diffForeignKey(key1: ForeignKey, key2: ForeignKey, tableDifferences: TableDifference): boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Returns the difference between the columns
|
|
40
40
|
* If there are differences this method returns field2, otherwise the boolean false.
|
|
@@ -248,7 +248,7 @@ class SchemaComparator {
|
|
|
248
248
|
const toForeignKeys = { ...toTable.getForeignKeys() };
|
|
249
249
|
for (const fromConstraint of Object.values(fromForeignKeys)) {
|
|
250
250
|
for (const toConstraint of Object.values(toForeignKeys)) {
|
|
251
|
-
if (!this.diffForeignKey(fromConstraint, toConstraint)) {
|
|
251
|
+
if (!this.diffForeignKey(fromConstraint, toConstraint, tableDifferences)) {
|
|
252
252
|
delete fromForeignKeys[fromConstraint.constraintName];
|
|
253
253
|
delete toForeignKeys[toConstraint.constraintName];
|
|
254
254
|
}
|
|
@@ -351,7 +351,7 @@ class SchemaComparator {
|
|
|
351
351
|
this.log(`renamed index detected in table ${tableDifferences.name}`, { old: removedIndexName, new: addedIndexName });
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
diffForeignKey(key1, key2) {
|
|
354
|
+
diffForeignKey(key1, key2, tableDifferences) {
|
|
355
355
|
if (key1.columnNames.join('~').toLowerCase() !== key2.columnNames.join('~').toLowerCase()) {
|
|
356
356
|
return true;
|
|
357
357
|
}
|
|
@@ -367,6 +367,9 @@ class SchemaComparator {
|
|
|
367
367
|
if (key1.localTableName === key1.referencedTableName && !this.platform.supportsMultipleCascadePaths()) {
|
|
368
368
|
return false;
|
|
369
369
|
}
|
|
370
|
+
if (key1.columnNames.some(col => tableDifferences.changedColumns[col]?.changedProperties.has('type'))) {
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
370
373
|
const defaultRule = ['restrict', 'no action'];
|
|
371
374
|
const rule = (key, method) => {
|
|
372
375
|
return (key[method] ?? defaultRule[0])
|