Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Content model migration
module.exports = function (migration) {
// create a new content type “Conference”
const conference = migration.createContentType('conference')
// set up the new fields
conference.createField('name').type('Symbol').required(true).name('Conference/Meetup name')
conference.createField('country').type('Symbol').required(true).name('Country Code')
// create the new reference fields on the “Event” content type
const event = migration.editContentType('event')
"linkContentType": ['conference']
// create new entries and link them
// take all events
contentType: 'event',
// the fields you want to use to derive entries
from: ['name', 'country', 'city'],
// to which field the new entries will be linked to
toReferenceField: 'conference',
// the content type of the new entries
derivedContentType: 'conference',
// the fields you want to set
derivedFields: ['name', 'country', 'city'],
// the ID of the newly created entries
identityKey: async (from) => {
// remove special characters and spacing
return getId(['en-US'])
// set the values for the newly created entries
deriveEntryForLocale: async (inputFields, locale) => {
return {
name:[locale].replace(/\s(\d{2,4}|#\d+)/g, ''),
country:[locale] || 'N/A',
city:[locale] || 'N/A'
// move the new field up
// newly created fields are at the end usually
// clean up the things you don't need anymore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment