@famgia/omnify-laravel 0.0.111 → 0.0.113
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-GDFAEEEG.js → chunk-3YANFHE5.js} +24 -2
- package/dist/chunk-3YANFHE5.js.map +1 -0
- package/dist/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +23 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/stubs/ai-guides/cursor/laravel.mdc.stub +17 -2
- package/stubs/ai-guides/cursor/migrations-workflow.mdc.stub +224 -0
- package/dist/chunk-GDFAEEEG.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -591,7 +591,29 @@ function extractManyToManyRelations(schema, allSchemas) {
|
|
|
591
591
|
const targetSchema = allSchemas[targetName];
|
|
592
592
|
const targetTable = toTableName(targetName);
|
|
593
593
|
const targetPkType = targetSchema ? getIdType(targetSchema) : "BigInt";
|
|
594
|
-
|
|
594
|
+
let isOwningSide;
|
|
595
|
+
if (assocProp.owning !== void 0) {
|
|
596
|
+
isOwningSide = assocProp.owning;
|
|
597
|
+
} else if (assocProp.pivotFields && Object.keys(assocProp.pivotFields).length > 0) {
|
|
598
|
+
isOwningSide = true;
|
|
599
|
+
} else {
|
|
600
|
+
let targetHasMappedByToThisSide = false;
|
|
601
|
+
if (targetSchema?.properties) {
|
|
602
|
+
for (const [, targetProp] of Object.entries(targetSchema.properties)) {
|
|
603
|
+
if (targetProp.type !== "Association") continue;
|
|
604
|
+
const targetAssoc = targetProp;
|
|
605
|
+
if (targetAssoc.relation === "ManyToMany" && targetAssoc.target === schema.name && targetAssoc.mappedBy) {
|
|
606
|
+
targetHasMappedByToThisSide = true;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (targetHasMappedByToThisSide) {
|
|
612
|
+
isOwningSide = true;
|
|
613
|
+
} else {
|
|
614
|
+
isOwningSide = schema.name < targetName;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
595
617
|
if (!isOwningSide) {
|
|
596
618
|
continue;
|
|
597
619
|
}
|