Commit aa447afe authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

database: Replanning the database and its data marts 7

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parent 2db0e842
This diff is collapsed.
/* Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
create index on dm_avail_state_history (project, contact_date);
create index on dm_avail_city_history (project, contact_date);
create index on dm_invent_machine (project, state, city);
create index on dm_audit_zm_school (project, state, city);
create index on dm_alert_machine (project, state, city);
create index on dm_alert_state_history (project, contact_date);
create index on dm_alert_city_history (project, contact_date);
......@@ -19,44 +19,44 @@
* USA.
*/
CREATE DATABASE proinfodata;
create database proinfodata;
\c proinfodata;
-- Enum type for the MEC project which the machines belong to
CREATE TYPE mec_project AS ENUM (
create type mec_project as enum (
'proinfo',
'uca_classmate',
'uca_server',
'projector'
);
CREATE TABLE sa_inventory (
project mec_project DEFAULT 'proinfo' NOT NULL
contact_date DATE NOT NULL,
inep VARCHAR(10) NOT NULL,
machine MACADDR NOT NULL,
hd1_model VARCHAR NOT NULL,
hd1_size INTEGER NOT NULL,
hd1_used INTEGER NOT NULL,
hd2_model VARCHAR,
hd2_size INTEGER,
hd2_used INTEGER,
other_hds INTEGER,
memory_size INTEGER NOT NULL,
processor VARCHAR NOT NULL,
os_type VARCHAR,
os_distro VARCHAR NOT NULL,
os_kernel VARCHAR NOT NULL,
internet_con BIT DEFAULT 1 NOT NULL,
create table sa_inventory (
project mec_project default 'proinfo' not null
contact_date date not null,
inep varchar(10) not null,
machine macaddr not null,
hd1_model varchar not null,
hd1_size integer not null,
hd1_used integer not null,
hd2_model varchar,
hd2_size integer,
hd2_used integer,
extra_hds integer default 0 not null,
memory_size integer not null,
processor varchar not null,
os_type varchar not null,
os_distro varchar not null,
os_kernel varchar not null,
internet_con boolean default true not null,
);
CREATE TABLE sa_net_usage (
inep VARCHAR(10) NOT NULL,
machine MACADDR NOT NULL,
contact_time TIMESTAMP NOT NULL,
pacotes_in integer,
bytes_in real,
pacotes_out integer,
bytes_out real
create table sa_net_usage (
inep varchar(10) not null,
machine macaddr not null,
contact_time timestamp not null,
pacotes_in integer not null,
bytes_in real not null,
pacotes_out integer not null,
bytes_out real not null
);
......@@ -19,5 +19,5 @@
* USA.
*/
CREATE USER my_user;
ALTER USER my_user PASSWORD 'password';
create role my_user login;
alter role my_user password 'password';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment