Frutik
1024-й
схема базы
после трудного дня чегото не соображу...
create table device (
id serial,
name varchar(254) unique not null,
primary key (id)
)
create table panel (
id serial,
name varchar(255),
primary key (id)
)
create table port (
panel int4 not null references panel(id),
port int4 not null,
primary key(panel, port)
)
create table layout (
device int4 unique not null references device(id),
panel int4 not null references port(panel),
port int4 not null references port(port),
primary key(device, panel, port)
)
последнюю таблицу не создает...
PostgreSQL said: ERROR: UNIQUE constraint matching given keys for referenced table "port" not found
после трудного дня чегото не соображу...
create table device (
id serial,
name varchar(254) unique not null,
primary key (id)
)
create table panel (
id serial,
name varchar(255),
primary key (id)
)
create table port (
panel int4 not null references panel(id),
port int4 not null,
primary key(panel, port)
)
create table layout (
device int4 unique not null references device(id),
panel int4 not null references port(panel),
port int4 not null references port(port),
primary key(device, panel, port)
)
последнюю таблицу не создает...
PostgreSQL said: ERROR: UNIQUE constraint matching given keys for referenced table "port" not found