@stacksjs/defaults 0.70.286 → 0.70.289

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.
@@ -141,6 +141,28 @@ duplicating that relationship column as an attribute.
141
141
  `morphedByMany`. Each takes an array of model names, or an object form when you
142
142
  need to name the foreign key.
143
143
 
144
+ The object form is also where a `belongsTo` says what happens to its row when
145
+ the row it points at is deleted:
146
+
147
+ ```ts
148
+ belongsTo: [
149
+ { model: 'Repository', onDelete: 'cascade' },
150
+ { model: 'User', foreignKey: 'author_id', onDelete: 'set null' },
151
+ ],
152
+ ```
153
+
154
+ `'cascade' | 'set null' | 'restrict' | 'no action'`, enforced by the database
155
+ on the foreign key. Left off, the default applies: the delete is refused while
156
+ a child still points at the row.
157
+
158
+ Worth declaring rather than deleting children in application code. The order
159
+ has to be right in every place that deletes, forever, and the place that misses
160
+ one leaves rows nothing can reach - while the database applies the rule to
161
+ deletes the application never made: a manual `DELETE`, a restore, another
162
+ service sharing the schema. Not for a polymorphic pair (`commentable_id`
163
+ beside `commentable_type`): those carry no foreign key at all, because a
164
+ constraint would name one table and reject every row pointing at another.
165
+
144
166
  Use the named object form for a many-to-many relation that owns its pivot
145
167
  schema. It keeps the relation accessor, migration, pivot defaults, timestamps,
146
168
  and uniqueness in the model definition:
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.70.286",
5
+ "version": "0.70.289",
6
6
  "description": "A modern Stacks development environment.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.286",
5
+ "version": "0.70.289",
6
6
  "description": "The complete managed Stacks application scaffold, including runtime defaults, AI guidance, editor metadata, and npm-backed project support files.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",