How to use schemas in PostgreSQL
My current database that I'd like to model has schemas. Do you support that?
Yes, we do.
Log in to Vertabelo and open your model. Select a table or view, and then expand "Additional properties" in the right panel:
There, you'll see the "Schema" field that you can activate by clicking "Set":
If the table was created without specifying any individual schema name, leave the "Schema" field empty (by default, such schema is named "public"). Otherwise, enter the schema name.
The generated SQL script will contain the schema name:
CREATE TABLE schema_name.table_name (...);
If you would like to add a clause creating a schema, you can do this in "Additional SQL scripts".
Make sure that no object is selected in your database model, and then expand "Additional SQL scripts" in the left panel:
Paste or type your code in the "Beginning of the create script" field, for example:
Then set the schema name in the "Schema" field separately for each object to be included within this particular schema, e.g.:
You can also define a specific schema name for all new tables or views to be created within your model. To do so, go to the Model Properties (right) panel (make sure, you haven't selected anything), and scroll all the way down to the Default Additional Properties
tab. There are more properties to set there, so make sure you take a look at it:
Kundesupport af UserEcho