owlps/writeInDb/owlps_db.sh

125 lines
2.4 KiB
Bash

-- =====================================
-- Nom de la base : owlps_db
-- Date de création : 25/06/09
-- =====================================
create table ap
(
id_ap serial not null unique,
ap_addr varchar(20) not null,
x float ,
y float ,
z float ,
friis_index float ,
freq bigint ,
antenna_gain float ,
output_power float ,
primary key (id_ap, ap_addr)
);
create table mobile
(
id_mobile serial not null unique,
mobile_addr varchar(20) not null,
ip_mobile varchar(20) ,
antenna_gain float ,
last_connect numeric(30) ,
primary key (id_mobile, mobile_addr)
);
create table building
(
id_building serial not null,
building_name varchar(50) ,
address varchar(100) ,
postal_code varchar(10) ,
city varchar(20) ,
primary key (id_building)
);
create table area
(
id_area serial not null,
name_area varchar(40) ,
x_min float ,
y_min float ,
z_min float ,
x_max float ,
y_max float ,
z_max float ,
id_building integer references building,
primary key (id_area)
);
create table waypoint
(
x float ,
y float ,
z float ,
id_building integer references building,
primary key (x,y,z)
);
create table ref_point
(
id_ref_point serial not null,
x float ,
y float ,
z float ,
direction char(1) ,
primary key (id_ref_point)
);
create table request
(
id_request serial not null,
mobile_time numeric(30) ,
id_mobile integer references mobile(id_mobile),
primary key (id_request)
);
create table ref_request
(
id_ref_request serial not null,
mobile_time numeric(30) ,
id_mobile integer references mobile(id_mobile),
id_ref_point integer references ref_point ON DELETE CASCADE,
primary key (id_ref_request)
);
create table packet
(
id_packet serial not null,
ap_time numeric(30) ,
power integer ,
id_ap integer references ap(id_ap),
id_request integer references request,
primary key (id_packet)
);
create table ref_packet
(
id_ref_packet serial not null,
ap_time numeric(30) ,
power integer ,
id_ap integer references ap(id_ap) ,
id_ref_request integer references ref_request ON DELETE CASCADE,
primary key (id_ref_packet)
);
create table result
(
id_result serial not null,
x float ,
y float ,
z float ,
direction char(1) ,
calcul_date numeric(30) ,
using_algo varchar(30) ,
id_request integer references request,
primary key (id_result)
);