refactor(plugin-workflow): change executions not to be deleted when workflow deleted (#5666)

* chore(ci): add retry

* refactor(plugin-workflow): change executions not to be deleted when workflow deleted

---------

Co-authored-by: xilesun <2013xile@gmail.com>
This commit is contained in:
Junyi 2024-11-20 14:53:29 +08:00 committed by GitHub
parent 3dd6d6d5ef
commit 1f4802e20f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View File

@ -2,9 +2,7 @@
"version": "1.3.51", "version": "1.3.51",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"npmClientArgs": [ "npmClientArgs": ["--ignore-engines"],
"--ignore-engines"
],
"command": { "command": {
"version": { "version": {
"forcePublish": true, "forcePublish": true,

View File

@ -18,12 +18,14 @@ describe('workflow > actions > workflows', () => {
let PostModel; let PostModel;
let PostRepo; let PostRepo;
let WorkflowModel; let WorkflowModel;
let ExecutionModel;
beforeEach(async () => { beforeEach(async () => {
app = await getApp(); app = await getApp();
agent = app.agent(); agent = app.agent();
db = app.db; db = app.db;
WorkflowModel = db.getCollection('workflows').model; WorkflowModel = db.getCollection('workflows').model;
ExecutionModel = db.getCollection('executions').model;
PostModel = db.getCollection('posts').model; PostModel = db.getCollection('posts').model;
PostRepo = db.getCollection('posts').repository; PostRepo = db.getCollection('posts').repository;
}); });
@ -119,7 +121,7 @@ describe('workflow > actions > workflows', () => {
}); });
describe('destroy', () => { describe('destroy', () => {
it('cascading destroy all revisions, nodes, executions and jobs', async () => { it('cascading destroy all revisions, nodes, but not executions and jobs', async () => {
const workflow = await WorkflowModel.create({ const workflow = await WorkflowModel.create({
enabled: true, enabled: true,
type: 'collection', type: 'collection',
@ -172,8 +174,8 @@ describe('workflow > actions > workflows', () => {
const w2c = await WorkflowModel.count(); const w2c = await WorkflowModel.count();
expect(w2c).toBe(0); expect(w2c).toBe(0);
const e2c = await workflow.countExecutions(); const e2c = await ExecutionModel.count();
expect(e2c).toBe(0); expect(e2c).toBe(1);
const n1c = await workflow.countNodes(); const n1c = await workflow.countNodes();
expect(n1c).toBe(0); expect(n1c).toBe(0);
const n2c = await w2.countNodes(); const n2c = await w2.countNodes();
@ -182,7 +184,7 @@ describe('workflow > actions > workflows', () => {
expect(p2c).toBe(1); expect(p2c).toBe(1);
const j2c = await JobModel.count(); const j2c = await JobModel.count();
expect(j2c).toBe(0); expect(j2c).toBe(1);
}); });
}); });

View File

@ -57,7 +57,6 @@ export default function () {
{ {
type: 'hasMany', type: 'hasMany',
name: 'executions', name: 'executions',
onDelete: 'CASCADE',
}, },
{ {
type: 'integer', type: 'integer',