mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
fix operations foreign key errors on Flow deletion (#15087)
This commit is contained in:
@@ -56,6 +56,9 @@ export class FlowsService extends ItemsService<FlowRaw> {
|
||||
async deleteOne(key: PrimaryKey, opts?: MutationOptions): Promise<PrimaryKey> {
|
||||
const flowManager = getFlowManager();
|
||||
|
||||
// this is to prevent foreign key constraint error on directus_operations resolve/reject during cascade deletion
|
||||
await this.knex('directus_operations').update({ resolve: null, reject: null }).where('flow', key);
|
||||
|
||||
const result = await super.deleteOne(key, opts);
|
||||
await flowManager.reload();
|
||||
|
||||
@@ -65,6 +68,9 @@ export class FlowsService extends ItemsService<FlowRaw> {
|
||||
async deleteMany(keys: PrimaryKey[], opts?: MutationOptions): Promise<PrimaryKey[]> {
|
||||
const flowManager = getFlowManager();
|
||||
|
||||
// this is to prevent foreign key constraint error on directus_operations resolve/reject during cascade deletion
|
||||
await this.knex('directus_operations').update({ resolve: null, reject: null }).whereIn('flow', keys);
|
||||
|
||||
const result = await super.deleteMany(keys, opts);
|
||||
await flowManager.reload();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user