View Question

ER primary key serial for Postgres

Hi, I'm using the Astah Professional to create my database, but all my tables needed to have flag SERIAL. This flag tells that my table is autoincremented on Postgres Database, but I don't figure out this option on Astah. Can someone help me?

Here is an example:

CREATE TABLE type
(
    id_type SERIAL PRIMARY KEY NOT NULL,
    ds_type VARCHAR(250) NOT NULL
);

How I can to do that on Astah and after to export correctly?

Product: Astah Professional

Hi Rodolfo,

You can add SERIAL as a datatype in Astah. Please see the following post that shows how to add ER datatypes in Astah.

How to add ER Data Type

After adding SERIAL as a datatype, set SERIAL to the datatype of id_type in the ER Diagram.

When you export sql from [Tools] - [ER Diagram] - [Export Sql], click the Option button in the Export SQL dialog and check ON the following option:

[Export Create Table statement with constraints (OFF: Alter Table)]

The following SQL will be exported:

CREATE TABLE type (
 id_type SERIAL NOT NULL PRIMARY KEY,
 ds_type VARCHAR(250) NOT NULL
);

Hi Midori, Thanks for your answer, this works perfectly!

Answer Question

This content has the following tags:

ERSERIALPOSTGRES