mirror of
https://github.com/strapi/strapi.git
synced 2025-09-23 07:22:51 +00:00
fix: prevent workflow name to be reseted when CE -> EE
Workflow name was reseted to 'Default' when upgrading to EE, because the migration files compares the workflow content type between the migration, and on CE -> EE the workflow content type does not exist in CE
This commit is contained in:
parent
ba65bb5b8a
commit
61d65e72f6
@ -3,6 +3,10 @@
|
|||||||
const { WORKFLOW_MODEL_UID } = require('../constants/workflows');
|
const { WORKFLOW_MODEL_UID } = require('../constants/workflows');
|
||||||
const defaultWorkflow = require('../constants/default-workflow.json');
|
const defaultWorkflow = require('../constants/default-workflow.json');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple workflows introduced the ability to name a workflow.
|
||||||
|
* This migration adds the default workflow name if the name attribute was added.
|
||||||
|
*/
|
||||||
async function migrateReviewWorkflowName({ oldContentTypes, contentTypes }) {
|
async function migrateReviewWorkflowName({ oldContentTypes, contentTypes }) {
|
||||||
// Look for RW name attribute
|
// Look for RW name attribute
|
||||||
const hadName = !!oldContentTypes?.[WORKFLOW_MODEL_UID]?.attributes?.name;
|
const hadName = !!oldContentTypes?.[WORKFLOW_MODEL_UID]?.attributes?.name;
|
||||||
@ -11,6 +15,9 @@ async function migrateReviewWorkflowName({ oldContentTypes, contentTypes }) {
|
|||||||
// Add the default workflow name if name attribute was added
|
// Add the default workflow name if name attribute was added
|
||||||
if (!hadName && hasName) {
|
if (!hadName && hasName) {
|
||||||
await strapi.query(WORKFLOW_MODEL_UID).updateMany({
|
await strapi.query(WORKFLOW_MODEL_UID).updateMany({
|
||||||
|
where: {
|
||||||
|
name: { $null: true },
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
name: defaultWorkflow.name,
|
name: defaultWorkflow.name,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user