Skip to content

Instantly share code, notes, and snippets.

@tjlee
Last active September 6, 2021 14:52
Show Gist options
  • Save tjlee/8a832e91a95d65caa651f47dd399e689 to your computer and use it in GitHub Desktop.
Save tjlee/8a832e91a95d65caa651f47dd399e689 to your computer and use it in GitHub Desktop.
Nodes sample DDL
create type node_type as enum (
''
);
create table node (
node_id serial primary key not null,
network cidr not null,
mac macaddr,
ip_addr inet not null,
serial_number varchar(50),
node node_type,
up_link varchar(50),
down_link varchar(50),
up_node_id int);
alter table node
add constraint node_to_upnode
foreign key (up_node_id) references node (node_id);
create table node_description (
node_id int,
hostname varchar(64),
station varchar(50),
vendor_id int,
model_id int,
location_id int,
address varchar(256),
client_id int,
description varchar(256));
alter table node_description
add constraint node_to_node_details
foreign key (node_id) references node (node_id);
create index node_description_node_id_index
on node_description (node_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment