Structure your data

What are Models?

Models are the powerful building block that Fuchsia's Records are built on top of. Models describe the shape of something. If we wanted to sell some cars on your mobile app or website, we would want our car salesmen/saleswomen to be able to add, edit and delete different cars that are available from Fuchsia. To do this, first we must create a Model of what a car is shaped like.

For example: if we were selling cars, our Car model would have fields like Paint Color, Doors, Engine Size, Description and Price.

  • Paint Color would have a field type of Color - So that when the users goes to edit a Car in the Fuchsia interface, they would see a Color picker to easily facilitate choosing a color and previewing it.

  • Doors would have a field type of Number - and this will allow any number to be chosen, but not letters or characters.

  • Engine Size would be a Choice field type. This would allow a predetermined list of engines that can be chosen from to be selected for any car.

  • Description would a Rich Text field type to allow fancy formatting of a car's more detailed features.

For more details on all field types, check out our fields guide.

Display Field

Models also have a "Display Field" attached to them. It is a field that is selected to represent the record in Fuchsia's user interface. If we have a Person model with fields First Name, Last Name, Age, and Address, we would select Last Name as our model's display field - this way it would be easy to see which records we have already saved.

Deleting Models

If you no longer need a model, you may delete it through the API or through the Fuchsia user interface. Be careful - this is a destructive operation and all collections and records connected to this model will also be deleted forever and permanently.