Fix DB schema files location with Module::Build

This commit is contained in:
Oliver Gorwits
2017-04-24 12:41:15 +01:00
parent 0737914af5
commit 48cb6dd4c1
42 changed files with 8 additions and 3 deletions

View File

@@ -14,10 +14,9 @@ our # try to hide from kwalitee
$VERSION = 41; # schema version used for upgrades, keep as integer
use Path::Class;
use File::Basename;
use File::ShareDir 'dist_dir';
my (undef, $libpath, undef) = fileparse( $INC{ 'App/Netdisco/DB.pm' } );
our $schema_versions_dir = Path::Class::Dir->new($libpath)
our $schema_versions_dir = Path::Class::Dir->new( dist_dir('App-Netdisco') )
->subdir("DB", "schema_versions")->stringify;
__PACKAGE__->load_components(qw/

View File

@@ -1,372 +0,0 @@
BEGIN;
-- admin table - Queue for admin tasks sent from front-end for back-end processing.
CREATE TABLE admin (
job serial,
entered TIMESTAMP DEFAULT now(),
started TIMESTAMP,
finished TIMESTAMP,
device inet,
port text,
action text,
subaction text,
status text,
username text,
userip inet,
log text,
debug boolean
);
CREATE INDEX idx_admin_entered ON admin(entered);
CREATE INDEX idx_admin_status ON admin(status);
CREATE INDEX idx_admin_action ON admin(action);
CREATE TABLE device (
ip inet PRIMARY KEY,
creation TIMESTAMP DEFAULT now(),
dns text,
description text,
uptime bigint,
contact text,
name text,
location text,
layers varchar(8),
ports integer,
mac macaddr,
serial text,
model text,
ps1_type text,
ps2_type text,
ps1_status text,
ps2_status text,
fan text,
slots integer,
vendor text,
os text,
os_ver text,
log text,
snmp_ver integer,
snmp_comm text,
snmp_class text,
vtp_domain text,
last_discover TIMESTAMP,
last_macsuck TIMESTAMP,
last_arpnip TIMESTAMP
);
-- Indexing for speed-ups
CREATE INDEX idx_device_dns ON device(dns);
CREATE INDEX idx_device_layers ON device(layers);
CREATE INDEX idx_device_vendor ON device(vendor);
CREATE INDEX idx_device_model ON device(model);
CREATE TABLE device_ip (
ip inet,
alias inet,
subnet cidr,
port text,
dns text,
creation TIMESTAMP DEFAULT now(),
PRIMARY KEY(ip,alias)
);
-- Indexing for speed ups
CREATE INDEX idx_device_ip_ip ON device_ip(ip);
CREATE INDEX idx_device_ip_alias ON device_ip(alias);
CREATE INDEX idx_device_ip_ip_port ON device_ip(ip,port);
CREATE TABLE device_module (
ip inet not null,
index integer,
description text,
type text,
parent integer,
name text,
class text,
pos integer,
hw_ver text,
fw_ver text,
sw_ver text,
serial text,
model text,
fru boolean,
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP,
PRIMARY KEY(ip,index)
);
CREATE TABLE device_port (
ip inet,
port text,
creation TIMESTAMP DEFAULT now(),
descr text,
up text,
up_admin text,
type text,
duplex text,
duplex_admin text,
speed text,
name text,
mac macaddr,
mtu integer,
stp text,
remote_ip inet,
remote_port text,
remote_type text,
remote_id text,
vlan text,
pvid integer,
lastchange bigint,
PRIMARY KEY(port,ip)
);
CREATE INDEX idx_device_port_ip ON device_port(ip);
CREATE INDEX idx_device_port_remote_ip ON device_port(remote_ip);
-- For the duplex mismatch finder :
CREATE INDEX idx_device_port_ip_port_duplex ON device_port(ip,port,duplex);
CREATE INDEX idx_device_port_ip_up_admin ON device_port(ip,up_admin);
CREATE INDEX idx_device_port_mac ON device_port(mac);
CREATE TABLE device_port_log (
id serial,
ip inet,
port text,
reason text,
log text,
username text,
userip inet,
action text,
creation TIMESTAMP DEFAULT now()
);
CREATE INDEX idx_device_port_log_1 ON device_port_log(ip,port);
CREATE INDEX idx_device_port_log_user ON device_port_log(username);
CREATE TABLE device_port_power (
ip inet,
port text,
module integer,
admin text,
status text,
class text,
power integer,
PRIMARY KEY(port,ip)
);
CREATE TABLE device_port_ssid (
ip inet,
port text,
ssid text,
broadcast boolean,
bssid macaddr
);
CREATE INDEX idx_device_port_ssid_ip_port ON device_port_ssid(ip,port);
CREATE TABLE device_port_vlan (
ip inet,
port text,
vlan integer,
native boolean not null default false,
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP DEFAULT now(),
vlantype text,
PRIMARY KEY(ip,port,vlan)
);
CREATE TABLE device_port_wireless (
ip inet,
port text,
channel integer,
power integer
);
CREATE INDEX idx_device_port_wireless_ip_port ON device_port_wireless(ip,port);
CREATE TABLE device_power (
ip inet,
module integer,
power integer,
status text,
PRIMARY KEY(ip,module)
);
CREATE TABLE device_vlan (
ip inet,
vlan integer,
description text,
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP DEFAULT now(),
PRIMARY KEY(ip,vlan)
);
CREATE TABLE log (
id serial,
creation TIMESTAMP DEFAULT now(),
class text,
entry text,
logfile text
);
CREATE TABLE node (
mac macaddr,
switch inet,
port text,
vlan text default '0',
active boolean,
oui varchar(8),
time_first timestamp default now(),
time_recent timestamp default now(),
time_last timestamp default now(),
PRIMARY KEY(mac,switch,port,vlan)
);
-- Indexes speed things up a LOT
CREATE INDEX idx_node_switch_port_active ON node(switch,port,active);
CREATE INDEX idx_node_switch_port ON node(switch,port);
CREATE INDEX idx_node_switch ON node(switch);
CREATE INDEX idx_node_mac ON node(mac);
CREATE INDEX idx_node_mac_active ON node(mac,active);
-- CREATE INDEX idx_node_oui ON node(oui);
CREATE TABLE node_ip (
mac macaddr,
ip inet,
active boolean,
time_first timestamp default now(),
time_last timestamp default now(),
PRIMARY KEY(mac,ip)
);
-- Indexing speed ups.
CREATE INDEX idx_node_ip_ip ON node_ip(ip);
CREATE INDEX idx_node_ip_ip_active ON node_ip(ip,active);
CREATE INDEX idx_node_ip_mac ON node_ip(mac);
CREATE INDEX idx_node_ip_mac_active ON node_ip(mac,active);
CREATE TABLE node_monitor (
mac macaddr,
active boolean,
why text,
cc text,
date TIMESTAMP DEFAULT now(),
PRIMARY KEY(mac)
);
-- node_nbt - Hold Netbios information for each node.
CREATE TABLE node_nbt (
mac macaddr PRIMARY KEY,
ip inet,
nbname text,
domain text,
server boolean,
nbuser text,
active boolean,
time_first timestamp default now(),
time_last timestamp default now()
);
-- Indexing speed ups.
CREATE INDEX idx_node_nbt_mac ON node_nbt(mac);
CREATE INDEX idx_node_nbt_nbname ON node_nbt(nbname);
CREATE INDEX idx_node_nbt_domain ON node_nbt(domain);
CREATE INDEX idx_node_nbt_mac_active ON node_nbt(mac,active);
-- Add "vlan" column to node table
-- ALTER TABLE node ADD COLUMN vlan text default '0';
alter table node drop constraint node_pkey;
alter table node add primary key (mac, switch, port, vlan);
CREATE TABLE node_wireless (
mac macaddr,
ssid text default '',
uptime integer,
maxrate integer,
txrate integer,
sigstrength integer,
sigqual integer,
rxpkt integer,
txpkt integer,
rxbyte bigint,
txbyte bigint,
time_last timestamp default now(),
PRIMARY KEY(mac,ssid)
);
-- Add "ssid" column to node_wireless table
-- ALTER TABLE node_wireless ADD ssid text default '';
alter table node_wireless drop constraint node_wireless_pkey;
alter table node_wireless add primary key (mac, ssid);
CREATE TABLE oui (
oui varchar(8) PRIMARY KEY,
company text
);
-- process table - Queue to coordinate between processes in multi-process mode.
CREATE TABLE process (
controller integer not null,
device inet not null,
action text not null,
status text,
count integer,
creation TIMESTAMP DEFAULT now()
);
CREATE TABLE sessions (
id char(32) NOT NULL PRIMARY KEY,
creation TIMESTAMP DEFAULT now(),
a_session text
);
CREATE TABLE subnets (
net cidr NOT NULL,
creation timestamp default now(),
last_discover timestamp default now(),
PRIMARY KEY(net)
);
-- Add "topology" table to augment manual topo file
CREATE TABLE topology (
dev1 inet not null,
port1 text not null,
dev2 inet not null,
port2 text not null
);
-- This table logs login and logout / change requests for users
CREATE TABLE user_log (
entry serial,
username varchar(50),
userip inet,
event text,
details text,
creation TIMESTAMP DEFAULT now()
);
CREATE TABLE users (
username varchar(50) PRIMARY KEY,
password text,
creation TIMESTAMP DEFAULT now(),
last_on TIMESTAMP,
port_control boolean DEFAULT false,
ldap boolean DEFAULT false,
admin boolean DEFAULT false,
fullname text,
note text
);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device_port_vlan ADD COLUMN vlantype text;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node_ip ADD COLUMN dns text;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node DROP CONSTRAINT node_pkey;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node_wireless DROP CONSTRAINT node_wireless_pkey;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node ADD COLUMN vlan text DEFAULT '0' NOT NULL;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node_wireless ADD COLUMN ssid text DEFAULT '' NOT NULL;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
CREATE INDEX device_port_power_idx_ip_port on device_port_power (ip, port);
COMMIT;

View File

@@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE admin DROP CONSTRAINT IF EXISTS admin_pkey;
ALTER TABLE admin ADD PRIMARY KEY (job);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node ADD PRIMARY KEY (mac, switch, port, vlan);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE node_wireless ADD PRIMARY KEY (mac, ssid);
COMMIT;

View File

@@ -1,14 +0,0 @@
BEGIN;
-- Database Schema Modifications for upgrading from 0.9x to 0.93
ALTER TABLE device_port ADD COLUMN remote_type text;
ALTER TABLE device_port ADD COLUMN remote_id text;
ALTER TABLE device_port ADD COLUMN vlan text;
ALTER TABLE device ADD COLUMN vtp_domain text;
ALTER TABLE users ADD COLUMN fullname text;
ALTER TABLE users ADD COLUMN note text;
COMMIT;

View File

@@ -1,10 +0,0 @@
BEGIN;
CREATE UNIQUE INDEX jobs_queued ON admin (
action,
coalesce(subaction, '_x_'),
coalesce(device, '255.255.255.255'),
coalesce(port, '_x_')
) WHERE status LIKE 'queued%';
COMMIT;

View File

@@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE topology ADD CONSTRAINT topology_dev1_port1 UNIQUE (dev1, port1);
ALTER TABLE topology ADD CONSTRAINT topology_dev2_port2 UNIQUE (dev2, port2);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device_port ADD COLUMN "manual_topo" bool DEFAULT false NOT NULL;
COMMIT;

View File

@@ -1,6 +0,0 @@
BEGIN;
ALTER TABLE device_port ADD COLUMN "is_uplink" bool;
ALTER TABLE device_port ADD COLUMN "is_uplink_admin" bool;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device_ip DROP CONSTRAINT "device_ip_alias";
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
-- ALTER TABLE device_port ALTER COLUMN remote_id TYPE bytea USING remote_id::bytea;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
-- ALTER TABLE device_port ALTER COLUMN remote_id TYPE text USING remote_id::text;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device ADD COLUMN snmp_comm_rw text;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device DROP COLUMN snmp_comm_rw;
COMMIT;

View File

@@ -1,9 +0,0 @@
BEGIN;
CREATE TABLE "community" (
"ip" inet NOT NULL,
"snmp_comm_rw" text,
PRIMARY KEY ("ip")
);
COMMIT;

View File

@@ -1,38 +0,0 @@
BEGIN;
-- Netdisco
-- Database Schema Modifications
-- UPGRADE from 0.93 to 0.94
ALTER TABLE device_port ADD COLUMN lastchange bigint;
ALTER TABLE log ADD COLUMN logfile text;
CREATE TABLE user_log (
entry serial,
username varchar(50),
userip inet,
event text,
details text,
creation TIMESTAMP DEFAULT now()
);
CREATE TABLE node_nbt (
mac macaddr PRIMARY KEY,
ip inet,
nbname text,
domain text,
server boolean,
nbuser text,
active boolean,
time_first timestamp default now(),
time_last timestamp default now()
);
-- Indexing speed ups.
CREATE INDEX idx_node_nbt_mac ON node_nbt(mac);
CREATE INDEX idx_node_nbt_nbname ON node_nbt(nbname);
CREATE INDEX idx_node_nbt_domain ON node_nbt(domain);
CREATE INDEX idx_node_nbt_mac_active ON node_nbt(mac,active);
COMMIT;

View File

@@ -1,8 +0,0 @@
BEGIN;
ALTER TABLE node_wireless ALTER COLUMN rxpkt TYPE bigint;
ALTER TABLE node_wireless ALTER COLUMN txpkt TYPE bigint;
ALTER TABLE node_wireless ALTER COLUMN rxbyte TYPE bigint;
ALTER TABLE node_wireless ALTER COLUMN txbyte TYPE bigint;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
DROP INDEX IF EXISTS jobs_queued;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE community ADD COLUMN snmp_auth_tag text;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
UPDATE node SET vlan = '0' WHERE vlan IS NULL;
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
CREATE INDEX node_ip_idx_ip_active ON node_ip (ip, active);
COMMIT;

View File

@@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE device_port_vlan DROP CONSTRAINT device_port_vlan_pkey;
ALTER TABLE device_port_vlan ADD PRIMARY KEY (ip, port, vlan, native);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE oui ADD COLUMN abbrev text;
COMMIT;

View File

@@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE device_port DROP COLUMN is_uplink_admin;
ALTER TABLE device_port ADD COLUMN "slave_of" text;
ALTER TABLE device_port ADD COLUMN "is_master" bool DEFAULT false NOT NULL;
COMMIT;

View File

@@ -1,15 +0,0 @@
-- clean up node table where vlan = 0 and vlan = <another number>
--
-- DELETE n1.*
-- FROM node n1 INNER JOIN
-- (SELECT mac, switch, port from node
-- GROUP BY mac, switch, port
-- HAVING count(*) > 1) n2
-- ON n1.mac = n2.mac
-- AND n1.switch = n2.switch
-- AND n1.port = n2.port
-- AND n1.vlan = '0';
BEGIN;
COMMIT;

View File

@@ -1,17 +0,0 @@
-- clean up node table where vlan = 0 and vlan = <another number>
--
-- DELETE n1.*
-- FROM node n1 INNER JOIN
-- (SELECT mac, switch, port from node
-- GROUP BY mac, switch, port
-- HAVING count(*) > 1) n2
-- ON n1.mac = n2.mac
-- AND n1.switch = n2.switch
-- AND n1.port = n2.port
-- AND n1.vlan = '0';
BEGIN;
DELETE FROM node AS n1 USING (SELECT mac, switch, port from node GROUP BY mac, switch, port HAVING count(*) > 1) n2 WHERE n1.mac = n2.mac AND n1.switch = n2.switch AND n1.port = n2.port AND n1.vlan = '0';
COMMIT;

View File

@@ -1,59 +0,0 @@
BEGIN;
-- Netdisco
-- Database Schema Modifications
-- UPGRADE from 0.94 to 0.95
CREATE TABLE subnets (
net cidr NOT NULL,
creation timestamp default now(),
last_discover timestamp default now(),
PRIMARY KEY(net)
);
--
-- node_nbt could already exist, if you upgraded to 0.94, but if
-- you ran pg_all in 0.94, node_nbt wasn't created. This
-- will report some harmless errors if it already exists.
CREATE TABLE node_nbt (
mac macaddr PRIMARY KEY,
ip inet,
nbname text,
domain text,
server boolean,
nbuser text,
active boolean, -- do we need this still?
time_first timestamp default now(),
time_last timestamp default now()
);
-- Indexing speed ups.
CREATE INDEX idx_node_nbt_mac ON node_nbt(mac);
CREATE INDEX idx_node_nbt_nbname ON node_nbt(nbname);
CREATE INDEX idx_node_nbt_domain ON node_nbt(domain);
CREATE INDEX idx_node_nbt_mac_active ON node_nbt(mac,active);
--
-- Add time_recent to node table
ALTER TABLE node ADD time_recent timestamp;
ALTER TABLE node ALTER time_recent SET DEFAULT now();
UPDATE node SET time_recent = time_first WHERE time_recent IS NULL;
--
-- Add table to contain wireless base station SSIDs
CREATE TABLE device_port_ssid (
ip inet, -- ip of device
port text, -- Unique identifier of Physical Port Name
ssid text, -- An SSID that is valid on this port.
broadcast boolean,-- Is it broadcast?
channel integer -- 802.11 channel number
);
CREATE INDEX idx_device_port_ssid_ip_port ON device_port_ssid(ip,port);
--
-- The OUI field in the oui database is now lowercase.
UPDATE oui SET oui=lower(oui);
COMMIT;

View File

@@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE community RENAME COLUMN snmp_auth_tag TO snmp_auth_tag_read;
ALTER TABLE community ADD COLUMN snmp_auth_tag_write text;
COMMIT;

View File

@@ -1,159 +0,0 @@
BEGIN;
-- Netdisco
-- Database Schema Modifications
-- UPGRADE from 0.95 to 0.96
--
-- Add snmp_class to device table
ALTER TABLE device ADD snmp_class text;
--
-- Add subnet to device_ip table
ALTER TABLE device_ip ADD subnet cidr;
--
-- Add indexes on admin table
CREATE INDEX idx_admin_entered ON admin(entered);
CREATE INDEX idx_admin_status ON admin(status);
CREATE INDEX idx_admin_action ON admin(action);
--
-- Create device_module table
CREATE TABLE device_module (
ip inet not null,
index integer,
description text,
type text,
parent integer,
name text,
class text,
pos integer,
hw_ver text,
fw_ver text,
sw_ver text,
serial text,
model text,
fru boolean,
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP
);
--
-- Earlier versions of device_module didn't have the index
ALTER TABLE device_module ADD PRIMARY KEY(ip,index);
-- Create process table - Queue to coordinate between processes in multi-process mode.
CREATE TABLE process (
controller integer not null, -- pid of controlling process
device inet not null,
action text not null, -- arpnip, macsuck, nbtstat, discover
status text, -- queued, running, skipped, done, error, timeout, nocdp, nosnmp
count integer,
creation TIMESTAMP DEFAULT now()
);
-- Earlier versions of the process table didn't have the creation timestamp
ALTER TABLE process ADD creation TIMESTAMP DEFAULT now();
--
-- Add ldap to users table
ALTER TABLE users ADD ldap boolean;
ALTER TABLE users ALTER ldap SET DEFAULT false;
--
-- Add pvid to device_port table
ALTER TABLE device_port ADD pvid integer;
--
-- Create device_port_vlan table
CREATE TABLE device_port_vlan (
ip inet, -- ip of device
port text, -- Unique identifier of Physical Port Name
vlan integer, -- VLAN ID
native boolean not null default false, -- native or trunked
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP DEFAULT now(),
PRIMARY KEY(ip,port,vlan)
);
--
-- Create device_vlan table
CREATE TABLE device_vlan (
ip inet, -- ip of device
vlan integer, -- VLAN ID
description text, -- VLAN description
creation TIMESTAMP DEFAULT now(),
last_discover TIMESTAMP DEFAULT now(),
PRIMARY KEY(ip,vlan)
);
--
-- Create device_power table
CREATE TABLE device_power (
ip inet, -- ip of device
module integer,-- Module from PowerEthernet index
power integer,-- nominal power of the PSE expressed in Watts
status text, -- The operational status
PRIMARY KEY(ip,module)
);
--
-- Create device_port_power table
CREATE TABLE device_port_power (
ip inet, -- ip of device
port text, -- Unique identifier of Physical Port Name
module integer,-- Module from PowerEthernet index
admin text, -- Admin power status
status text, -- Detected power status
class text, -- Detected class
PRIMARY KEY(port,ip)
);
CREATE TABLE device_port_wireless (
ip inet, -- ip of device
port text, -- Unique identifier of Physical Port Name
channel integer,-- 802.11 channel number
power integer -- transmit power in mw
);
CREATE INDEX idx_device_port_wireless_ip_port ON device_port_wireless(ip,port);
--
-- device_port_ssid lost its channel column, it moved to device_port_wireless
--
-- Migrate any existing data
INSERT INTO device_port_wireless ( ip,port,channel ) ( SELECT ip,port,channel FROM device_port_ssid WHERE channel IS NOT NULL );
ALTER TABLE device_port_ssid DROP channel;
--
-- node_wireless, for client association information
CREATE TABLE node_wireless (
mac macaddr,
uptime integer,
maxrate integer, -- can be 0.5 but we ignore that for now
txrate integer, -- can be 0.5 but we ignore that for now
sigstrength integer, -- signal strength (-db)
sigqual integer, -- signal quality
rxpkt integer, -- received packets
txpkt integer, -- transmitted packets
rxbyte bigint, -- received bytes
txbyte bigint, -- transmitted bytes
time_last timestamp default now(),
PRIMARY KEY(mac)
);
--
-- node_monitor, for lost/stolen device monitoring
CREATE TABLE node_monitor (
mac macaddr,
active boolean,
why text,
cc text,
date TIMESTAMP DEFAULT now(),
PRIMARY KEY(mac)
);
COMMIT;

View File

@@ -1,14 +0,0 @@
BEGIN;
-- Netdisco
-- Database Schema Modifications
-- UPGRADE from 1.0 to 1.1
--
-- Add index to node_ip table
CREATE INDEX idx_node_ip_ip_active ON node_ip(ip,active);
-- Add "power" column to device_port_power table
ALTER TABLE device_port_power ADD power integer;
COMMIT;

View File

@@ -1,33 +0,0 @@
BEGIN;
-- Netdisco
-- Database Schema Modifications
-- UPGRADE from 1.1 to 1.2
-- Add "vlantype" column to device_port_vlan table
ALTER TABLE device_port_vlan ADD vlantype text;
-- Add "topology" table to augment manual topo file
CREATE TABLE topology (
dev1 inet not null,
port1 text not null,
dev2 inet not null,
port2 text not null
);
-- Add "bssid" column to device_port_ssid table
ALTER TABLE device_port_ssid ADD bssid macaddr;
-- Add "vlan" column to node table
ALTER TABLE node ADD vlan text DEFAULT '0';
ALTER TABLE node DROP CONSTRAINT node_pkey;
ALTER TABLE node ADD PRIMARY KEY (mac, switch, port, vlan);
-- Add "ssid" column to node_wireless table
ALTER TABLE node_wireless ADD ssid text DEFAULT '';
ALTER TABLE node_wireless DROP CONSTRAINT node_wireless_pkey;
ALTER TABLE node_wireless ADD PRIMARY KEY (mac, ssid);
COMMIT;

View File

@@ -1,10 +0,0 @@
BEGIN;
CREATE TABLE "topology" (
"dev1" inet NOT NULL,
"port1" text NOT NULL,
"dev2" inet NOT NULL,
"port2" text NOT NULL
);
COMMIT;

View File

@@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE device_port_ssid ADD COLUMN bssid macaddr;
COMMIT;