Author: Vertabelo Team
Tip #12 – The quickest possible way to create a new column
From our previous Tip #2 you could learn how to move between columns in your table using just arrow keys. Now, we will show you how to use the Down arrow to create one or even more new columns. Probably, this is the fastest way of creating new columns in this part of the galaxy. You really have to learn this.
Open your database model and select the table in which you want to create a new column.
Tip #11 – Vertabelo reports that my data type is not supported. What can I do?
Sometimes you may want to use a data type that is so new that Vertabelo doesn’t recognize it. In such cases, the application displays a warning that the data type is not supported. If you find these warnings too distracting, you can turn them off. In this post, we will show you how to do it.
Let’s take a look at the following example.
Assume that you have a database model for MySQL 5.
24 Database Modeling Tips for Vertabelo
This one is frequently asked on our support: “In the data types panel, I can’t find the data type I need. Does this mean I cannot use it in Vertabelo?”
Of course, you can. Vertabelo will never let you get stuck in a data type dead end. Even if the type you need is not listed, it doesn’t mean you cannot use it. Data types you can find under the button are just the most popular ones.
Tip #9 – How to create multiple references between two tables
Relationships in the real world may not be as easy as we would like them to be. Sometimes we want to model a situation where one table is refering to the other more than once. Luckily, with Vertabelo, this is a piece of cake.
Let’s say we want to model a rental agreement between two people: landlord and tenant. In this situation, the rental_agreement table would need to refer to the person table twice – first for the landlord and second for the tenant.
Tip #8 – Setting Your Own Names for Primary Key
Sometimes the naming convention you use requires a specific pattern for the primary keys’ names. That’s why you may want to set your own names for each primary key in your database model instead of using default ones. Go on reading to get to know how to do this in Vertabelo.
To give your own name to a primary key, select the table that contains the primary key you want to name:
Tip #7 – How to include comments in SQL script
You can comment on your database objects (tables, columns, views) in Vertabelo. You can also include this metadata in your database, where it can be accessed by your SQL developers or DBAs.
Here’s how you can do it.
Go to your database model:
Click SQL generation settings in the Model properties panel on the right:
Check the Include comments for database objects option:
Let’s try out how it works.
Tip #6 – How to Create a Multicolumn Primary Key
Primary keys may contain more than one column. Multicolumn primary keys are frequently used for junction tables, which are used to model many-to-many relationships. Select a table:
In the Table properties panel on the right, check all the columns that you want inside the key:
Now, you have a multicolumn primary key created:
You can check out your SQL code by clicking the SQL preview button in the top right corner:
Tip #5 – How to quote table names in generated SQL script
Sometimes, you want all identifiers in your SQL script to be quoted. For example, you want them to have a particular case. Luckily, Vertabelo allows you to quote all SQL identifiers in your generated script to prevent you from any SQL name conflicts.
Go to your model:
Click the SQL generation settings tab in the Model properties panel on the right:
Check Quote all SQL identifiers:
Tip #4 – How to Make a Column Unique
Sometimes there are columns in a table that don’t belong to primary key, but are still unique. To mark them as a unique, you have to create an alternate (unique) key containing it.
Single-column alternate (unique) key Select the table with the column you want to make a unique. Then, click the Alternate (unique) key tab in the Table properties panel on the right:
Click Add key:
24 Database Modeling Tips for Vertabelo
Did you know that you can copy tables between models in Vertabelo? It’s useful for instance with tables that appear in almost every database model like user_account, address, client or product, or with tables that are specific for your domain. You don’t have to create all these tables from scratch.
Open the model which contains the tables you want to copy and click to select them. Note that you can hold down the Ctrl key if you want to select objects located in different parts of your model: