chore: cascade can replace set null action (#3812)

This commit is contained in:
ChengLei Shao 2024-03-25 16:02:52 +08:00 committed by GitHub
parent 088f3977a2
commit 2195a31f5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,9 @@ class ReferencesMap {
existReference.onDelete = reference.onDelete;
existReference.priority = reference.priority;
} else if (newPriority === existPriority && newPriority === PRIORITY_MAP['user']) {
if (existReference.onDelete === 'SET NULL' && reference.onDelete === 'CASCADE') {
existReference.onDelete = reference.onDelete;
} else {
throw new Error(
`On Delete Conflict, exist reference ${JSON.stringify(existReference)}, new reference ${JSON.stringify(
reference,
@ -59,6 +62,7 @@ class ReferencesMap {
);
}
}
}
if (!existReference) {
this.map.set(reference.targetCollectionName, [