Skip to content

PostgreSQL Producer

Simon Mourier edited this page Feb 19, 2020 · 1 revision

The PostgreSQL Producer is a persistence code generator: it translates a CodeModeler model into a database running on PostgreSQL Server 8.4 and upper. The database is created by generating SQL scripts which are then automatically ran on the configured server.

It relies on the Npgsql package. Depending on context, the producer may alsorequires the libossp-uuid package to be installed on the server. With a Linux server, the postgresql-contrib package may also be needed.

As other producers, to add it, you must click on the “Add New Producer” context menu of the Producers folder node:

PostgreSQL Producer - Picture 287

Application configuration

You need to configure the generated classes to use PostgreSQL as persistence layer (“persistenceTypeName” attribute) and set a connection string indicating them where to connect to (“connectionString” attribute). Here's a sample configuration for a sample application named Northwind:

<configSections>
  <section name="Northwind" type="CodeModeler.Runtime.CodeModelerConfigurationSectionHandler, CodeModeler.Runtime" />
</configSections>
<Northwind persistenceTypeName="PostgreSQL"
           connectionString="Server=localhost;Database=PostgreSQL_Test;User Id=postgres;Password=yourpassword;"
           postgresql-defaultSchema="public"
           postgresql-useParameterCache="true" />

Notes:

  • postrgresql-defaultSchema and postgresql-useParameterCache are optional and their respective default values are "public" and "true".

  • The default schema defines the schema to be used when an entity doesn't have a schema. By default, the "public" schema is used.

  • The postgresql-useParameterCache attribute allows you to disable the use of the parameter cache system which stores lists of parameters for each stored procedure that is used.

Supported features

The following features are supported:

  • Generating schemas and cross-schemas relations

  • Generating tables

  • Generating constraints (primary keys and foreign keys)

  • Generating sequences for auto-incremented columns

  • Generating views

  • Generating stored procedures (using SQL or PL/pgSQL)

  • Generating instances

  • Saving instances

  • Saving Binary Large Objects (BLOB) instances in bytea columns

Unsupported features

The following features are not supported:

  • CMQL Search methods

  • Differential engine

Clone this wiki locally