@famgia/omnify-laravel 0.0.47 → 0.0.49
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/dist/{chunk-AF6XW6JU.js → chunk-RP2B7BTK.js} +19 -2
- package/dist/chunk-RP2B7BTK.js.map +1 -0
- package/dist/index.cjs +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +18 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-AF6XW6JU.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -106,6 +106,9 @@ function propertyToColumnMethod(propertyName, property, options = {}) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
const baseProp = property;
|
|
109
|
+
if (baseProp.primaryKey) {
|
|
110
|
+
modifiers.push({ method: "primary" });
|
|
111
|
+
}
|
|
109
112
|
if (baseProp.nullable) {
|
|
110
113
|
modifiers.push({ method: "nullable" });
|
|
111
114
|
}
|
|
@@ -471,10 +474,24 @@ function schemaToBlueprint(schema, allSchemas, options = {}) {
|
|
|
471
474
|
seenIndexes.add(key);
|
|
472
475
|
return true;
|
|
473
476
|
});
|
|
477
|
+
let primaryKey;
|
|
478
|
+
if (hasAutoId(schema)) {
|
|
479
|
+
primaryKey = ["id"];
|
|
480
|
+
} else if (schema.properties) {
|
|
481
|
+
const pkColumns = [];
|
|
482
|
+
for (const [propName, property] of Object.entries(schema.properties)) {
|
|
483
|
+
if (property.primaryKey) {
|
|
484
|
+
pkColumns.push(toColumnName(propName));
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (pkColumns.length > 0) {
|
|
488
|
+
primaryKey = pkColumns;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
474
491
|
return {
|
|
475
492
|
tableName,
|
|
476
493
|
columns,
|
|
477
|
-
primaryKey
|
|
494
|
+
primaryKey,
|
|
478
495
|
foreignKeys,
|
|
479
496
|
indexes: uniqueIndexes
|
|
480
497
|
};
|