Files
TJWaterServer/table.sql
2022-08-21 11:13:13 +08:00

36 lines
883 B
SQL

drop table if exists Link;
drop table if exists Node;
drop type if exists EN_NodeType;
create type EN_NodeType as enum (
'EN_JUNCTION',
'EN_RESERVOIR',
'EN_TANK'
);
drop type if exists EN_LinkType;
create type EN_LinkType as enum (
'EN_CVPIPE',
'EN_PIPE',
'EN_PUMP',
'EN_PRV',
'EN_PSV',
'EN_PBV',
'EN_FCV',
'EN_TCV',
'EN_GPV'
);
create table Node (
Id varchar(32) primary key,
Type EN_NodeType not null,
Coord point not null default(point(0.0, 0.0)),
Elevation numeric not null default(0.0)
);
create table Link (
Id varchar(32) primary key,
Type EN_LinkType not null,
FromNode varchar(32) not null references Node(Id),
ToNode varchar(32) not null references Node(Id)
);