db: Modified database definitions for consent_type table.

Consent_type table uses id, and consent table now refers to consent_type_id instead of name.
Additionally, added index of consent_time to consent table.
This commit is contained in:
Shawn Kwang 2018-06-15 14:50:48 -05:00
parent cc6efacb8d
commit 431d8d6542
4 changed files with 13 additions and 11 deletions

View File

@ -180,7 +180,8 @@ alter table sent_email
-- for delete account
alter table consent
add index userid_cname(userid, consent_name);
add index userid_ctid(userid, consent_type_id);
add index consent_timestamp(consent_time);
alter table consent_type
add index consent_name(shortname);

View File

@ -4,6 +4,6 @@
The table must be first defined in schema.sql before any content
is added!
*/
insert into consent_type (consent_id, shortname, description, enabled, protected, privacypref)
insert into consent_type (id, shortname, description, enabled, protected, privacypref)
values (1, 'ENROLL', 'General terms-of-use for this BOINC project.', 0, 1, 0),
(2, 'STATSEXPORT', 'Do you consent to exporting your data to BOINC statistics aggregation Web sites?', 0, 1, 1);

View File

@ -809,7 +809,7 @@ create table host_deleted (
create table consent (
id integer not null auto_increment,
userid integer not null,
consent_name varchar(255) not null,
consent_type_id integer not null,
consent_time integer not null,
consent_flag tinyint not null,
consent_not_required tinyint not null,
@ -818,11 +818,11 @@ create table consent (
) engine=InnoDB;
create table consent_type (
consent_id integer not null auto_increment,
id integer not null auto_increment,
shortname varchar(255) not null,
description varchar(255) not null,
enabled integer not null,
protected integer not null,
privacypref integer not null,
primary key (consent_id)
primary key (id)
) engine=InnoDB;

View File

@ -1166,34 +1166,35 @@ function update_5_17_2018() {
do_query("create table consent (
id integer not null auto_increment,
userid integer not null,
consent_name varchar(255) not null,
consent_type_id integer not null,
consent_time integer not null,
consent_flag tinyint not null,
consent_not_required tinyint not null,
source varchar(255) not null,
primary key (id),
index userid_cname (userid, consent_name)
index userid_ctid(userid, consent_type_id),
index consent_timestamp(consent_time)
) engine=InnoDB;
");
do_query("create table consent_type (
consent_id integer not null auto_increment,
id integer not null auto_increment,
shortname varchar(255) not null,
description varchar(255) not null,
enabled integer not null,
protected integer not null,
privacypref integer not null,
primary key (consent_id),
primary key (id),
index consent_name (shortname)
) engine=InnoDB;
");
do_query("insert into consent_type
(consent_id, shortname, description, enabled, protected, privacypref) values
(id, shortname, description, enabled, protected, privacypref) values
(1, 'ENROLL', 'General terms-of-use for this BOINC project.', 0, 1, 0);
");
do_query("insert into consent_type
(consent_id, shortname, description, enabled, protected, privacypref) values
(id, shortname, description, enabled, protected, privacypref) values
(2, 'STATSEXPORT', 'Do you consent to exporting your data to BOINC statistics aggregation Web sites?', 0, 1, 1);
");
}