Make onUpdate cascade explicit for database

pull/172/head
Candid Dauth 2021-05-03 00:38:32 +02:00
rodzic 9a239ae056
commit fa27bd0445
1 zmienionych plików z 1 dodań i 0 usunięć

Wyświetl plik

@ -47,6 +47,7 @@ export const dataDefinition = {
export function makeNotNullForeignKey(type: string, field: string, error = false): AssociationOptions {
return {
as: type,
onUpdate: "CASCADE",
onDelete: error ? "RESTRICT" : "CASCADE",
foreignKey: { name: field, allowNull: false }
}