To do that go to the project Schema tab, where you can change the project, add and remove entities, and rebuild the project. Here is a video example how to modify schema of your app.
The basic essence of the Schema Editor is that it consists of tables and columns and your work will consist of working with them.
When working with tables, you have 2 options - add a new table or delete it (all, except the default Users table). Now let's take a look at each of these steps separately.
When working with columns, you have 3 options - add or remove a column, or change the properties of the column.
Working with tables
- adding the table: to add a table, you need to press the '+ Add Table' button (see screenshot below). After clicking the button, a new table will be added and you will be prompted to select a name for this table. Please follow SQL table naming standards. Please choose the name in lower case for better code generation. You can add an unlimited number of tables to the paid plan and the free plan. For example, users, categories, tags, tags1, tags2, etc.
- deleting the table: deleting a table is very simple - you just need to select the table you want to delete and click the 'Destroy Table' button. The table and all columns referring to it will be deleted immediately. Please note that the ‘Users’ table can not be deleted.
Working with columns
- adding column: to create a column, you need to click on the table in which you want to create a column and then click on the
+ Add Columnbutton. Then the Edit column window with the following parameters will open on the right side:
Note: Our generator adds the column ID itself and makes the connection if necessary: you don't need to add the column ID yourself.
|Name||SQL column name and code property. Use snake or camel case. Note, the column name cannot start with a number.||
|Title||Property visible name in user interface||
The following types are offered to choose from:
|String||stores text data||
|Date time||stores full date only with time||
|Date||stores full date only, without time||
|Enumeration||stores any value from specified list||
|Images||stores image files||
|Files||stores any raw files||
|Relation (one)||one-sided relation capable of storing one of other entity||
|Relation (many)||two-sided relation capable of storing any number of other entity||
- editing column: to change a created column, click on it, and on the right side of the modal window, you will see the ‘Edit Column’ menu, where you will see the properties that you can change. In editing a column, it is possible to change only the name, title, show in form and show in table. Please, use a camel case, numbers and “_” for column names.
Note: The column name cannot start with a number. Also, there cannot be the same-named columns in one table.
- deleting column: Deleting a column is done by selecting the column you want to delete and pressing the Destroy button. The column should be deleted immediately. You cannot delete the last column in the table.
Pushing changes to GitHub
After you made your changes to the schema at the Schema Editor tab, you need to push your changes to your GitHub repository by clicking on Push to GitHub button or Push changes.
Next, the Flatlogic Bot creates a new commit at your GitHub repository for you and uploads your new code there. This commit will contain all required changes and new classes for created entities and main changes.
Here is a video example of How to deploy updates to the cloud.
There are two branches: master & generated. Master - is for you to make changes directly in the source code. Generated is for Flatlogic Bot to make changes to the generated code.
All changes that you’ve done at the Schema Editor tab will commit to the Generated branch. After this, you need to create a pull request and merge Generated branch into the Master.
You need to click on ‘Compare & Pull request’.
Next, go back to your project page, go to the Settings tab and click on “Deploy”. It will regenerate your application. When you press any Deploy button, the code will be taken from the GitHub. This means that if there is a GitHub connected, the code will always be taken from there.