Confusing validations error from the Migrations CLI

Ah I see - we don’t have any DSL in place yet that tracks down the type of a field when updating a field property.

So usually validations is a legit property that can be assigned to any field except arrays. Here we have to assign it on the items sub-key.

For now your best bet is to do the following:

module.exports = function (migration) {
  const campaign = migration.editContentType('campaign');

  campaign.editField('quizzes')
    .items({
      type: 'Link',
      linkType: 'Entry',
      validations: [{
        linkContentType: [
          'quizBeta', 'quiz'
        ],
      }]
    });
}

Please not that this replaces the whole items object, so you need to state properties like type again. This is less than optimal, but should unblock you for now.

Best,
Stephan

1 Like