Contentful logo

Contentful Community

Untitled value is shown in Name field for Content type created using Migration CLI

#1

Hi,
I have created a new Content type using Migration CLI. It works well but when i add entries to it, on UI Name field shows Untitled. If i open the Content type and just save it then on UI Name field shows my Title value.

Why I need to just save the Content type created using Migration CLI to display its Title on UI in Name column? Is there any way in Migration CLI script to perform this unnecessaary save?

module.exports = function (migration) {
const mySample = migration.createContentType(‘mySample’, {
name: ‘My Sample’,
description: ‘My Sample’
});
mySample.createField(‘title’, {
name: ‘Title’,
type: ‘Symbol’,
required: true,
});
mySample.createField(‘description’, {
name: ‘Description’,
type: ‘Text’
});
};

-Bharat

0 Likes

#2

Hi @bharats!

You just need to add the following to the end of your migration script:

mySample.displayField('title');

Hope that helps!

0 Likes