From 5dae47d5f171cccffbb513571f98fa7f424e0df9 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 21 Apr 2022 18:08:33 +0800 Subject: [PATCH] fix: set null on delete --- packages/plugins/users/src/server.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/plugins/users/src/server.ts b/packages/plugins/users/src/server.ts index d74ccee45..7da44c3e6 100644 --- a/packages/plugins/users/src/server.ts +++ b/packages/plugins/users/src/server.ts @@ -59,6 +59,8 @@ export default class UsersPlugin extends Plugin { dataIndex: 'state.currentUser.id', createOnly: true, visible: true, + onDelete: 'SET NULL', + onUpdate: 'CASCADE', }); collection.setField('createdBy', { type: 'belongsTo', @@ -73,6 +75,8 @@ export default class UsersPlugin extends Plugin { dataType: 'integer', dataIndex: 'state.currentUser.id', visible: true, + onDelete: 'SET NULL', + onUpdate: 'CASCADE', }); collection.setField('updatedBy', { type: 'belongsTo',