chore: set belongs to many on delete to cascade (#1311)

This commit is contained in:
ChengLei Shao 2023-01-01 23:15:08 +08:00 committed by GitHub
parent 38b5974b90
commit d317fa056a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,9 +30,11 @@ export class BelongsToManyField extends RelationField {
references(association): Reference[] { references(association): Reference[] {
const db = this.context.database; const db = this.context.database;
const onDelete = this.options.onDelete || 'CASCADE';
return [ return [
BelongsToField.toReference(db, association.toSource, this.options.onDelete), BelongsToField.toReference(db, association.toSource, onDelete),
BelongsToField.toReference(db, association.toTarget, this.options.onDelete), BelongsToField.toReference(db, association.toTarget, onDelete),
]; ];
} }