masterrecord 0.3.46 → 0.3.47
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/Migrations/schema.js +8 -2
- package/package.json +1 -1
package/Migrations/schema.js
CHANGED
|
@@ -297,8 +297,12 @@ class schema{
|
|
|
297
297
|
const existingNames = new Set((existing || []).map(c => (c.name || c.COLUMN_NAME))); // both engines map to name
|
|
298
298
|
// Add missing columns only (safe path)
|
|
299
299
|
for (var key in table) {
|
|
300
|
-
|
|
300
|
+
// Skip metadata properties (indexes, __compositeIndexes, __name, etc.)
|
|
301
|
+
if(key === 'indexes' || key.startsWith('__')) continue;
|
|
302
|
+
if(typeof table[key] === 'object' && !Array.isArray(table[key])){
|
|
301
303
|
const col = table[key];
|
|
304
|
+
// Skip if missing name/type (not a valid column definition)
|
|
305
|
+
if(!col.name || !col.type) continue;
|
|
302
306
|
// Skip relationships
|
|
303
307
|
if(col.type === 'hasOne' || col.type === 'hasMany' || col.type === 'hasManyThrough') continue;
|
|
304
308
|
const colName = (col.relationshipType === 'belongsTo' && col.foreignKey) ? col.foreignKey : col.name;
|
|
@@ -337,8 +341,10 @@ class schema{
|
|
|
337
341
|
// Detect modifications (nullable/default/type)
|
|
338
342
|
const desiredCols = [];
|
|
339
343
|
for (var key in table) {
|
|
340
|
-
if(
|
|
344
|
+
if(key === 'indexes' || key.startsWith('__')) continue;
|
|
345
|
+
if(typeof table[key] === 'object' && !Array.isArray(table[key])){
|
|
341
346
|
const col = table[key];
|
|
347
|
+
if(!col.name || !col.type) continue;
|
|
342
348
|
if(col.type === 'hasOne' || col.type === 'hasMany' || col.type === 'hasManyThrough') continue;
|
|
343
349
|
const colName = (col.relationshipType === 'belongsTo' && col.foreignKey) ? col.foreignKey : col.name;
|
|
344
350
|
desiredCols.push({ name: colName, col });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "masterrecord",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.47",
|
|
4
4
|
"description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
|
|
5
5
|
"main": "MasterRecord.js",
|
|
6
6
|
"bin": {
|