Hello @mat_jack1 I share you the code’s migrations
banner migratrion
‘use strict’;
module.exports = async (client) => {
// DatoCMS migration script
const bannerModel = await client.itemTypes.create({
name: 'Banner',
apiKey: 'banner',
});
const textField = await client.fields.create(bannerModel.id, {
label: 'Text',
apiKey: 'text',
fieldType: 'text',
validators: {
required: {}
},
appearence : {
editor : 'wysiwyg'
},
defaultValue: null
});
const urlField = await client.fields.create(bannerModel.id,{
label : 'Url',
apiKey: 'url',
fieldType : 'string',
validators : {
required : {},
format : { predefined_pattern : 'url' }
},
appearence :{
editor : 'single_line',
parametres : { heading : false },
addons : []
}
});
const imagesField = await client.fields.create(bannerModel.id,{
label : 'Images',
apiKey : 'images',
fieldType : 'file',
validators : {
required : {},
}
});
}
space migration
‘use strict’;
module.exports = async (client) => {
const modelIdOrApiKey = ‘banner’;
client.itemTypes.find(modelIdOrApiKey)
.then( async (itemType) => {
const spaceModel = await client.itemTypes.create({
name: 'Space',
apiKey: 'space',
});
const titleField = await client.fields.create(spaceModel.id, {
label: 'Name',
apiKey: 'name',
fieldType: 'string',
validators: {
required: {},
},
appearance: {
editor: 'single_line',
parameters: {
heading: true,
},
addons: [],
},
});
const linkField = await client.fields.create( spaceModel,{
label : 'Layout',
apiKey: 'layout',
fieldType: 'link',
validators:{
itemItemType : { itemTypes : [itemType.id] }
},
appearance : {
editor : 'link_select'
}
});
})
.catch((error) => {
console.log('spaces error');
console.error(error);
});
}
Also I attached an screenshot result