Author Topic: PostgreSQL and CONSTRAINT UNIQUE  (Read 609 times)

marcusmolin76

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
PostgreSQL and CONSTRAINT UNIQUE
« on: May 19, 2006, 10:57:43 am »
Hello,
I'm using EA 6.1.789 to visualize the schema of a PostgreSQL
database.

I'd like to add a UNIQUE constraint to one of the tables,
which would be an euqivalent of

CREATE TABLE user_station
(
 id int4 NOT NULL DEFAULT nextval('user_station_id_seq'::regclass),
 user_id int4 NOT NULL,
 station_id int4 NOT NULL,
 CONSTRAINT user_station_user_id_key UNIQUE (user_id, station_id)
);

This table's PK is the "id" column, and both "user_id" and "station_id" are unique together.

Is there any way I can achieve with EA?

Thanks!

hd

  • EA Administrator
  • EA User
  • *****
  • Posts: 306
  • Karma: +0/-0
    • View Profile
Re:  PostgreSQL and CONSTRAINT UNIQUE
« Reply #1 on: May 21, 2006, 03:25:14 pm »
  • Add an operation called "user_station_user_id_key" (select table and press F10) and select "unique" as it's sterotype. Save.
  • Select operation, select "Columns" tabe, and select the required columns from the Column Name: drop down.