1. Adam Dutko
  2. Portfolio

Source

Portfolio / gnib / sql / schema.sql

drop database if exists gnib;

create database gnib;

grant insert,delete,update,select on gnib.* to 'gnibAdmin'@'localhost' identified by 'gnibs'; 

flush privileges;

create table gnib.projects (
    id INT auto_increment,
    name varchar(255),
    index proj_id_idx (id)
) engine=innodb, default character set=utf8;

create table gnib.versions (
    id INT auto_increment,
    project_id INT,
    version varchar(255),
    index versions_id_idx (id),
    foreign key (project_id) references projects (id) on update cascade on delete cascade 
) engine=innodb, default character set=utf8;

create table gnib.files (
    id INT auto_increment,
    version_id INT,
    name varchar(255),
    index files_id_idx (id),
    foreign key (version_id) references versions (id) on update cascade on delete cascade
) engine=innodb, default character set=utf8;

create table gnib.statistics (
    id INT auto_increment,
    version_id INT,
    size INT,
    c_file_count INT,
    h_file_count INT,
    cpp_file_count INT,
    directory_count INT,
    c_includes_count INT,
    h_includes_count INT,
    index statistics_id_idx (id),
    foreign key (version_id) references versions (id) on update cascade on delete cascade
) engine=innodb, default character set=utf8;

create table gnib.components (
    id INT auto_increment,
    file_id INT,
    name varchar(255),
    type varchar(255),
    line_number int,
    value varchar(255),
    index components_id_idx (id),
    foreign key (file_id) references files (id) on update cascade on delete cascade
) engine=innodb, default character set=utf8;