Development Guides
Generated Applications
Edit Data Models

Edit Data Models


ROQ provides a database model or schema editor sometime we call it Data Model Editor. It is designed so you can easily customize the generated application data model to meet your business needs.

You can access the Data Model Editor feature in ROQ Console with a few ways:

Onboarding Console Page

You can access the data model editor from the onboarding page. Go to HomeGet Started page and find the Step 3: Fine-tune your database model section and click the Edit Data Model button.

Edit schema button

Generated Application

You can access the data model editor in the generated application too. There is an Edit data model button in the top of the generated application.

Edit schema button on generate app

Data Model Editor

Using the Data Model Editor, you can add models, add fields, create and edit relationships.

Depending on the generated application, the screenshot below shows entities for the Library Management application.

data model editor

Modifying Models

Let's take an example, to add a new model or new table into the database for a Library Management application. Suppose we want to add ISBN data model into the database, these are the typical neccessary steps:

Add New Models

To add a new model (essentially the same with add a new table), click the + Add new table button and then ROQ will provides a new table with the default fields and values.

add new table

Add Fields

For our ISBN data model we can name the table isbn* and then we can add number field to the model.

add field

Create Relationships

Generally a book will have one and only one ISBN. From this information we can specify the relationship between book and isbn is One to One.

You can add or edit the relationship with clicking the Edit relationships button and then select the options:

  • Select Related Model: book
  • Model Relationships: One to One
  • Foreign Key Name: isbn_id

add relationship

Save every changes with clicking the Save button.

Applied New Models

To apply new models to the application, we need to regenerate the application.

Regenerate Application

You can do this by clicking the Generate Application button and then ROQ will regenerate the application with the new models applied.

regenerate application

This regeneration process will create a new application version, yes now you have two application versions, and you can select the application version from the EnvironmentProjects menu.

Select the application version