Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update default refential action values. #221

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ Use the following syntax to apply referential actions
relation(onUpdate=<ACTION>, onDelete=<ACTION>)
```

For instance, the default behavior in Serverpod can be expressed as.
## Default values
If no referential actions are specified, the default behavior will be applied.

If the relation is defined as an [object relation](one-to-one#with-an-object), the default behavior is `NoAction` for both onUpdate and onDelete.

```yaml
parent: Model?, relation(onUpdate=NoAction, onDelete=NoAction)
```


If the relation is defined as an [id relation](one-to-one#with-an-id-field), the default behavior is `NoAction` for onUpdate and `Cascade` for onDelete.


```yaml
relation(onUpdate=NoAction, onDelete=Cascade)
parentId: int?, relation(parent=model_table, onUpdate=NoAction, onDelete=Cascade)
```

:::info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@ Use the following syntax to apply referential actions
relation(onUpdate=<ACTION>, onDelete=<ACTION>)
```

For instance, the default behavior in Serverpod can be expressed as.
## Default values
If no referential actions are specified, the default behavior will be applied.

If the relation is defined as an [object relation](one-to-one#with-an-object), the default behavior is `NoAction` for both onUpdate and onDelete.

```yaml
relation(onUpdate=NoAction, onDelete=Cascade)
parent: Model?, relation(onUpdate=NoAction, onDelete=NoAction)
```


If the relation is defined as an [id relation](one-to-one#with-an-id-field), the default behavior is `NoAction` for onUpdate and `Cascade` for onDelete.


```yaml
parentId: int?, relation(parent=model_table, onUpdate=NoAction, onDelete=Cascade)
```

:::info

The sequence of onUpdate and onDelete is interchangeable.
Expand All @@ -41,4 +53,3 @@ fields:
```

In the given example, if the `example` parent is updated, the `parentId` will be set to null. If the parent is deleted, no action will be taken for parentId.

Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ Use the following syntax to apply referential actions
relation(onUpdate=<ACTION>, onDelete=<ACTION>)
```

For instance, the default behavior in Serverpod can be expressed as.
## Default values
If no referential actions are specified, the default behavior will be applied.

If the relation is defined as an [object relation](one-to-one#with-an-object), the default behavior is `NoAction` for both onUpdate and onDelete.

```yaml
parent: Model?, relation(onUpdate=NoAction, onDelete=NoAction)
```


If the relation is defined as an [id relation](one-to-one#with-an-id-field), the default behavior is `NoAction` for onUpdate and `Cascade` for onDelete.


```yaml
relation(onUpdate=NoAction, onDelete=Cascade)
parentId: int?, relation(parent=model_table, onUpdate=NoAction, onDelete=Cascade)
```

:::info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ Use the following syntax to apply referential actions
relation(onUpdate=<ACTION>, onDelete=<ACTION>)
```

For instance, the default behavior in Serverpod can be expressed as.
## Default values
If no referential actions are specified, the default behavior will be applied.

If the relation is defined as an [object relation](one-to-one#with-an-object), the default behavior is `NoAction` for both onUpdate and onDelete.

```yaml
parent: Model?, relation(onUpdate=NoAction, onDelete=NoAction)
```


If the relation is defined as an [id relation](one-to-one#with-an-id-field), the default behavior is `NoAction` for onUpdate and `Cascade` for onDelete.


```yaml
relation(onUpdate=NoAction, onDelete=Cascade)
parentId: int?, relation(parent=model_table, onUpdate=NoAction, onDelete=Cascade)
```

:::info
Expand Down
Loading