Model

The model is the core asset, the model is used as a data source, which passed to template to generate code.
How the model is designed and useing the init shceme is important. The model of this project is come from the database. The model is directly related to set task and write template.

Related knowledge:

Model

Tag


Model Design

We have created a new book table in the database. How to transfrom to a model?

The book table has 4 fields(MySql):

After we have configured the database connection, find this table and click the Default transform.

The model structure as follows: the default simply transform the original structure model of the database.

According to the business logic, the model is missing some information.

Required properties:

Required columns:

Init Scheme

We can manually add and modify these required properties and fields:

Of course, there are more easily way to set it up directly when you transfrom model with init scheme.

More about init scheme, please read:

Select the custom init scheme.

The required properties and fields are available, and we make a little modification to get the final model.

Summary

The model can add or modify some information according to the requirements of the project, and most of the work can be done in the init scheme. Please read the follow-up content.