mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
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:
parent
3dd6d6d5ef
commit
1f4802e20f
@ -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,
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ export default function () {
|
|||||||
{
|
{
|
||||||
type: 'hasMany',
|
type: 'hasMany',
|
||||||
name: 'executions',
|
name: 'executions',
|
||||||
onDelete: 'CASCADE',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user