Comparing version 0.14.3 to 0.14.4
@@ -94,7 +94,10 @@ "use strict"; | ||
const all_indexes = {}; | ||
const all_foreign_keys = {}; | ||
for (const table of tables) { | ||
table_schemas[table] = await this._getSchema(table); | ||
all_indexes[table] = await this._getIndexes(table); | ||
all_foreign_keys[table] = await this._getForeignKeys(table); | ||
} | ||
return { | ||
foreign_keys: all_foreign_keys, | ||
indexes: all_indexes, | ||
@@ -564,2 +567,11 @@ tables: table_schemas, | ||
/** @internal */ | ||
async _getForeignKeys(table) { | ||
const rows = await this._client.allAsync(`PRAGMA foreign_key_list(\`${table}\`)`); | ||
const foreign_keys = {}; | ||
for (const row of rows) { | ||
foreign_keys[row.from] = row.table; | ||
} | ||
return foreign_keys; | ||
} | ||
/** @internal */ | ||
_buildUpdateSetOfColumn(property, data, values, fields, places, insert = false) { | ||
@@ -566,0 +578,0 @@ const dbname = property._dbname_us; |
@@ -265,3 +265,4 @@ "use strict"; | ||
for (const index in (_c = current.indexes) === null || _c === void 0 ? void 0 : _c[modelClass.table_name]) { | ||
if (!lodash_1.default.find(modelClass._indexes, (item) => item.options.name === index)) { | ||
// MySQL add index for foreign key, so does not need to remove if the index is defined in integrities | ||
if (!lodash_1.default.find(modelClass._indexes, (item) => item.options.name === index) && !lodash_1.default.find(modelClass._integrities, (item) => item.column === index)) { | ||
changes.push({ message: `Remove index on ${modelClass.table_name} ${index}`, ignorable: true }); | ||
@@ -287,3 +288,3 @@ } | ||
&& current.foreign_keys[modelClass.table_name][integrity.column]; | ||
if (!(current_foreign_key && current_foreign_key === integrity.parent.table_name)) { | ||
if (!(current_foreign_key && current_foreign_key === integrity.parent.table_name) && this._adapter.native_integrity) { | ||
const table_name = modelClass.table_name; | ||
@@ -290,0 +291,0 @@ const parent_table_name = integrity.parent.table_name; |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.14.3", | ||
"version": "0.14.4", | ||
"keywords": [ | ||
@@ -71,3 +71,3 @@ "orm", | ||
}, | ||
"gitHead": "3c16d92a0676d0a07d22ee25f26499b6c9249ca3" | ||
"gitHead": "72ff458d110180903c7358cccd8f9388e175f505" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325048
8831