create table if not exists app ( id serial not null, name varchar(256) not null, url varchar(1024) not null, constraint app_pk primary key (id) ); create unique index if not exists app_id_uindex on app (id); alter table project_app add constraint project_app_app_id_fk foreign key (app_id) references app;