@famgia/omnify 1.0.106 → 1.0.108

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.
@@ -526,11 +526,75 @@ tags:
526
526
  type: Association
527
527
  relation: ManyToMany
528
528
  target: Tag
529
- pivotTable: post_tags # Optional: custom pivot table name
529
+ joinTable: post_tags # Optional: custom pivot table name
530
+ owning: true # Optional: marks this as the owning side
530
531
  pivotFields: # Optional: extra pivot fields
531
- - name: order
532
+ order:
532
533
  type: Int
533
534
  default: 0
535
+ assigned_at:
536
+ type: Timestamp
537
+ nullable: true
538
+ ```
539
+
540
+ **Pivot Fields** - Additional columns on the pivot table:
541
+ ```yaml
542
+ # Organization.yaml - Owning side with pivotFields
543
+ users:
544
+ type: Association
545
+ relation: ManyToMany
546
+ target: User
547
+ joinTable: organization_user
548
+ owning: true
549
+ pivotFields:
550
+ org_role:
551
+ type: String
552
+ length: 50
553
+ default: "'member'" # String default needs quotes
554
+ is_default:
555
+ type: Boolean
556
+ default: false
557
+ joined_at:
558
+ type: Timestamp
559
+ nullable: true
560
+ invited_by:
561
+ type: BigInt
562
+ nullable: true
563
+ unsigned: true
564
+
565
+ # User.yaml - Inverse side with mappedBy
566
+ organizations:
567
+ type: Association
568
+ relation: ManyToMany
569
+ target: Organization
570
+ joinTable: organization_user
571
+ mappedBy: users # References the owning side property
572
+ ```
573
+
574
+ **Generated Migration:**
575
+ ```php
576
+ Schema::create('organization_user', function (Blueprint $table) {
577
+ $table->unsignedBigInteger('organization_id');
578
+ $table->unsignedBigInteger('user_id');
579
+ $table->string('org_role', 50)->default('member');
580
+ $table->boolean('is_default')->default(false);
581
+ $table->timestamp('joined_at')->nullable();
582
+ $table->bigInteger('invited_by')->nullable()->unsigned();
583
+ $table->timestamp('created_at')->nullable();
584
+ $table->timestamp('updated_at')->nullable();
585
+ // ... foreign keys and indexes
586
+ });
587
+ ```
588
+
589
+ **Generated Model:**
590
+ ```php
591
+ // Both sides get withPivot() automatically
592
+ public function users(): BelongsToMany
593
+ {
594
+ return $this->belongsToMany(User::class, 'organization_user')
595
+ ->withPivot('org_role', 'is_default', 'joined_at', 'invited_by')
596
+ ->withTimestamps();
597
+ }
534
598
  ```
535
599
 
536
600
  ### OneToOne (1:1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "description": "Schema-driven database migration system with TypeScript types and Laravel migrations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,14 +25,14 @@
25
25
  "README.md"
26
26
  ],
27
27
  "dependencies": {
28
- "@famgia/omnify-cli": "0.0.102",
29
- "@famgia/omnify-core": "0.0.96",
30
- "@famgia/omnify-types": "0.0.94",
31
- "@famgia/omnify-typescript": "0.0.84",
32
- "@famgia/omnify-mcp": "0.0.82",
33
- "@famgia/omnify-atlas": "0.0.90",
34
- "@famgia/omnify-japan": "0.0.89",
35
- "@famgia/omnify-laravel": "0.0.105"
28
+ "@famgia/omnify-cli": "0.0.104",
29
+ "@famgia/omnify-laravel": "0.0.107",
30
+ "@famgia/omnify-core": "0.0.98",
31
+ "@famgia/omnify-types": "0.0.96",
32
+ "@famgia/omnify-atlas": "0.0.92",
33
+ "@famgia/omnify-mcp": "0.0.84",
34
+ "@famgia/omnify-typescript": "0.0.86",
35
+ "@famgia/omnify-japan": "0.0.91"
36
36
  },
37
37
  "keywords": [
38
38
  "omnify",