]> rtime.felk.cvut.cz Git - linux-conf-perf.git/blob - scripts/databaseinit.sql
Implemented database
[linux-conf-perf.git] / scripts / databaseinit.sql
1 --
2 -- Drop all tables
3 --
4 DROP TABLE IF EXISTS measure;
5 DROP TABLE IF EXISTS configurations;
6 DROP TABLE IF EXISTS toolsgit;
7
8 --
9 -- Initialize database
10 --
11
12 -- In this table are tracked versions of tools in git
13 CREATE TABLE toolsgit (
14         id BIGSERIAL PRIMARY KEY, -- Id
15         git_describe text NOT NULL, -- Git describe string (--always --tags --dirty)
16         git_commit text NOT NULL -- Commit hash of version of tool used for generating
17 );
18
19 -- In this table are stored all generated configurations
20 CREATE TABLE configurations (
21         id BIGSERIAL PRIMARY KEY, -- Id
22         hash char(34) NOT NULL, -- Hash of configuration
23         cfile text NOT NULL, -- File path with configuration
24         gtime timestamp NOT NULL, -- Time and date of generation
25         toolgit BIGINT REFERENCES toolsgit (id) -- Reference to git version of tools 
26 );
27
28 -- This table stores measured data
29 CREATE TABLE measure (
30         id BIGSERIAL PRIMARY KEY, -- Id
31         conf BIGINT REFERENCES configurations (id), -- Reference to configuration
32         mfile text NOT NULL, -- File with measuring output
33         value BIGINT DEFAULT null, -- Measured data value
34         mtime timestamp NOT NULL, -- Time and date of measurement
35         toolgit BIGINT REFERENCES toolsgit (id) -- Reference to git version of tools 
36 );