Skip to content

Rebuild

Preserving Customizations over Iterations

Your customizations are made to the files in the following sections. These are separate files from the core model and api files, so that (if you wish) you can recreate the system from a revised schema, then simply copy over the files described below.

 

Rebuilding

Ignoring the boxes labeled "rebuild", the key elements of the creation process are illustrated below:

  • the system reads the database schema to create models.py

  • models.py drives the creation process

  • you customize the created project, mainly by altering the files on the far right

As shown in the diagram, creation is always driven from models.py. Models differ from physical schemas in important ways:

  • the system ensure that class names are capitalized and singular

  • there are good reasons to customize models.py:

  • to add foreign keys missing in the database - these are critical for multi-table apis and applications
  • to provide better naming

You can rebuild your project, preserving customizations (including any additional files you have created). You have 2 alternatives, depending on where you choose the "source of truth" for your database:

Source of Truth Means Use rebuild option
Database The schema is the source of truth

It includes all the foreign keys
rebuild-from-datatabase: rebuilds the files shown in blue and purple.
Model Model is the source of truth

Use SQLAlchemy services to drive changes into the database
rebuild-from-model: rebuilds the files shown in blue

Note that ui/admin/admin.yaml is never overwritten (the dotted line means it is written on only on create commands). After rebuilds, merge the new ui/admin/admin-created.yaml into your customized admin.yaml.

 

API and Admin App merge updates

As of release 5.02.03, rebuild services provide support for updating customized API and Admin:

System Object Support
API api/expose_api_models_created.py created with new database/models.py classes
Admn App ui/admin/admin-merge.yaml is the merge of ui/admin/admin.yaml and new database/models.py classes

Review the altered files, edit (if required), and copy them over the original files.