@reldens/storage 0.111.0 → 0.112.0

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/CLAUDE.md +20 -0
  2. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -284,6 +284,26 @@ All generated entity relations follow the `related_*` prefix pattern:
284
284
 
285
285
  This pattern is consistent across all ORM drivers and is defined in `entities-config.js`.
286
286
 
287
+ ## Reference Properties Delete Rule
288
+
289
+ Every generated `type: 'reference'` property also carries the foreign key referential action as
290
+ `onDelete: '<rule>'`, so consumers can tell what a parent delete does to the child rows without querying the
291
+ schema themselves.
292
+
293
+ - `MysqlTablesProvider` joins `information_schema.REFERENTIAL_CONSTRAINTS` on the FK constraint name and stores
294
+ the raw `DELETE_RULE` as `column.referencedDeleteRule`.
295
+ - `BaseGenerator.mapDeleteRule()` normalizes it to camel case, matching the Prisma vocabulary: `CASCADE` becomes
296
+ `cascade`, `SET NULL` becomes `setNull`, `NO ACTION` becomes `noAction`, `SET DEFAULT` becomes `setDefault`,
297
+ `RESTRICT` stays `restrict`.
298
+ - `BaseGenerator.addReferenceDeleteRule()` pushes the attribute, called from
299
+ `EntitiesGeneration.addTypeAttribute()` right after the `alias`. Only the entities are affected, the ORM model
300
+ generation does not emit it.
301
+ - The property is omitted when there is no rule to report, so an entity generated before this existed simply has
302
+ no `onDelete` and consumers must treat a missing value as unknown rather than assuming a default.
303
+
304
+ Regenerating entities is required after changing a foreign key referential action: the rule is read live from
305
+ `information_schema`, not from `prisma/schema.prisma`, and `prisma db pull` alone does not update it.
306
+
287
307
  ## Prisma Driver Validation System
288
308
 
289
309
  ### ensureRequiredFields() Method
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/storage",
3
3
  "scope": "@reldens",
4
- "version": "0.111.0",
4
+ "version": "0.112.0",
5
5
  "description": "Reldens - Storage",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",