Content Migrations in Craft

On Your Own: Adding Additional Fields to the Content Migration

It's time to put your new skills to work! Add three fields to our fields migration and then run it to add the remaining fields in the contact form.

Our con­tact form is miss­ing some fields. We still need to add fields for com­pa­ny, phone num­ber, and a mes­sage. Now that you have expe­ri­ence cre­at­ing fields in a Craft con­tent migra­tion, go ahead and cre­ate those fields yourself. 

A few tips:

  • All of the fields will be of the type Plain Text.
  • The mes­sage field will need to be mul­ti­line, and you can set a min­i­mum rows count. 
  • Add a char­ac­ter lim­it to the phone num­ber field to con­strain its length.

Once you have the fields defined, don’t for­get to add the code to the return state­ment to cre­ate those new fields!

Content Migrations in Craft is made up of the following videos: