Skip to content

Commit

Permalink
add on delete constraint to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ronenlu committed Sep 18, 2023
1 parent ccec372 commit 210da5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ts/testdata/models/Email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class Email extends Model {
@Column(DataType.INTEGER)
contact_id!: number;

@BelongsTo(() => Contact)
@BelongsTo(() => Contact, {
onDelete: "CASCADE",
})
contact!: Contact;

@CreatedAt
Expand Down
4 changes: 3 additions & 1 deletion ts/testdata/models/Phone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class Phone extends Model {
@Column(DataType.INTEGER)
contact_id!: number;

@BelongsTo(() => Contact)
@BelongsTo(() => Contact, {
onDelete: "CASCADE",
})
contact!: Contact;

@CreatedAt
Expand Down

0 comments on commit 210da5d

Please sign in to comment.