@famgia/omnify 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/README.md +16 -8
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -94,7 +94,7 @@ properties:
94
94
  options:
95
95
  timestamps: true # adds created_at, updated_at
96
96
  softDelete: true # adds deleted_at
97
- primaryKeyType: Int # Int | BigInt | Uuid
97
+ idType: Int # Int | BigInt | Uuid | String
98
98
  ```
99
99
 
100
100
  ### 4. Generate code
@@ -217,31 +217,30 @@ properties:
217
217
 
218
218
  ### Associations (Relationships)
219
219
 
220
+ Define relationships between schemas. See [full documentation](./docs/associations.md) for details.
221
+
220
222
  ```yaml
221
223
  # schemas/post.yaml
222
224
  name: Post
223
225
  properties:
224
226
  title:
225
227
  type: String
226
- content:
227
- type: Text
228
228
 
229
- # BelongsTo relationship
229
+ # ManyToOne (BelongsTo) - creates author_id column
230
230
  author:
231
231
  type: Association
232
232
  relation: ManyToOne
233
233
  target: User
234
- mappedBy: posts
235
234
  onDelete: CASCADE
236
235
 
237
- # HasMany relationship
236
+ # OneToMany (HasMany) - no column, inverse of ManyToOne
238
237
  comments:
239
238
  type: Association
240
239
  relation: OneToMany
241
240
  target: Comment
242
241
  inversedBy: post
243
242
 
244
- # ManyToMany relationship
243
+ # ManyToMany - creates pivot table
245
244
  tags:
246
245
  type: Association
247
246
  relation: ManyToMany
@@ -249,6 +248,15 @@ properties:
249
248
  inversedBy: posts
250
249
  ```
251
250
 
251
+ | Relation | Description | Creates Column |
252
+ |----------|-------------|----------------|
253
+ | `ManyToOne` | BelongsTo, has FK | Yes (`{name}_id`) |
254
+ | `OneToMany` | HasMany, inverse side | No |
255
+ | `OneToOne` | One-to-one, use `owningSide` | Owner side only |
256
+ | `ManyToMany` | Many-to-many | Pivot table |
257
+
258
+ **Options:** `onDelete`, `onUpdate` (`CASCADE`, `SET NULL`, `RESTRICT`), `nullable`, `inversedBy`, `mappedBy`
259
+
252
260
  ### Enum Schema
253
261
 
254
262
  ```yaml
@@ -269,7 +277,7 @@ values:
269
277
  options:
270
278
  timestamps: true # Add created_at, updated_at
271
279
  softDelete: true # Add deleted_at for soft deletes
272
- primaryKeyType: Int # Int | BigInt | Uuid
280
+ idType: Int # Int | BigInt | Uuid | String
273
281
  table: custom_table # Custom table name (default: snake_case of name)
274
282
  ```
275
283
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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,8 +25,8 @@
25
25
  "@famgia/omnify-cli": "0.0.9",
26
26
  "@famgia/omnify-core": "0.0.7",
27
27
  "@famgia/omnify-types": "0.0.7",
28
- "@famgia/omnify-atlas": "0.0.7",
29
- "@famgia/omnify-laravel": "0.0.9"
28
+ "@famgia/omnify-laravel": "0.0.9",
29
+ "@famgia/omnify-atlas": "0.0.7"
30
30
  },
31
31
  "keywords": [
32
32
  "omnify",