2003-12-15 02:31:29 +00:00
|
|
|
/* If you add/change anything, update
|
|
|
|
boinc_db.C,h
|
|
|
|
and if needed:
|
2004-09-27 04:26:51 +00:00
|
|
|
py/Boinc/
|
|
|
|
database.py
|
|
|
|
html/
|
2004-12-06 22:41:19 +00:00
|
|
|
inc/
|
|
|
|
host.inc (host)
|
2004-09-27 04:26:51 +00:00
|
|
|
db_ops.inc
|
2007-04-24 23:21:42 +00:00
|
|
|
ops/
|
|
|
|
db_update.php
|
2004-09-27 04:26:51 +00:00
|
|
|
user/
|
2004-12-06 22:41:19 +00:00
|
|
|
create_account_action.php (user)
|
|
|
|
team_create_action.php (team)
|
2003-12-15 02:31:29 +00:00
|
|
|
sched/
|
2004-12-06 22:41:19 +00:00
|
|
|
db_dump.C (host, user, team)
|
|
|
|
db_purge.C (workunit, result)
|
2003-11-28 23:11:22 +00:00
|
|
|
*/
|
2003-11-25 15:51:19 +00:00
|
|
|
/* Fields are documented in boinc_db.h */
|
|
|
|
/* Do not replace this with an automatically generated schema */
|
2003-08-15 17:36:44 +00:00
|
|
|
|
2004-08-16 11:31:59 +00:00
|
|
|
/* type is specified as InnoDB for most tables.
|
2004-08-07 20:23:22 +00:00
|
|
|
Supposedly this gives better performance.
|
|
|
|
The others (post, thread, profile) are myISAM
|
|
|
|
because it supports fulltext index
|
|
|
|
*/
|
|
|
|
|
2004-10-08 00:16:33 +00:00
|
|
|
/* fields ending with id (but not _id) are treated specially
|
|
|
|
by the Python code (db_base.py)
|
|
|
|
*/
|
|
|
|
|
2003-08-15 17:36:44 +00:00
|
|
|
create table platform (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
name varchar(254) not null,
|
|
|
|
user_friendly_name varchar(254) not null,
|
|
|
|
deprecated tinyint not null default 0,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table app (
|
2010-03-29 22:28:20 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
name varchar(254) not null,
|
|
|
|
min_version integer not null default 0,
|
|
|
|
deprecated smallint not null default 0,
|
|
|
|
user_friendly_name varchar(254) not null,
|
|
|
|
homogeneous_redundancy smallint not null default 0,
|
|
|
|
weight double not null default 1,
|
|
|
|
beta smallint not null default 0,
|
|
|
|
target_nresults smallint not null default 0,
|
2010-06-17 16:44:33 +00:00
|
|
|
min_avg_pfc double not null default 1,
|
2010-11-10 00:10:32 +00:00
|
|
|
host_scale_check tinyint not null default 0,
|
2011-06-06 03:40:42 +00:00
|
|
|
homogeneous_app_version tinyint not null default 0,
|
2012-08-25 04:09:24 +00:00
|
|
|
non_cpu_intensive tinyint not null default 0,
|
2012-08-27 17:00:43 +00:00
|
|
|
locality_scheduling integer not null default 0,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table app_version (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
appid integer not null,
|
|
|
|
version_num integer not null,
|
|
|
|
platformid integer not null,
|
|
|
|
xml_doc mediumblob,
|
|
|
|
min_core_version integer not null default 0,
|
|
|
|
max_core_version integer not null default 0,
|
|
|
|
deprecated tinyint not null default 0,
|
|
|
|
plan_class varchar(254) not null default '',
|
|
|
|
pfc_n double not null default 0,
|
|
|
|
pfc_avg double not null default 0,
|
|
|
|
pfc_scale double not null default 0,
|
|
|
|
expavg_credit double not null default 0,
|
|
|
|
expavg_time double not null default 0,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table user (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
email_addr varchar(254) not null,
|
|
|
|
name varchar(254),
|
|
|
|
authenticator varchar(254),
|
|
|
|
country varchar(254),
|
|
|
|
postal_code varchar(254),
|
|
|
|
total_credit double not null,
|
|
|
|
expavg_credit double not null,
|
|
|
|
expavg_time double not null,
|
|
|
|
global_prefs blob,
|
|
|
|
project_prefs blob,
|
|
|
|
teamid integer not null,
|
|
|
|
venue varchar(254) not null,
|
|
|
|
url varchar(254),
|
|
|
|
send_email smallint not null,
|
|
|
|
show_hosts smallint not null,
|
|
|
|
posts smallint not null,
|
2009-08-18 20:44:12 +00:00
|
|
|
-- reused: salt for weak auth
|
2011-09-21 21:26:00 +00:00
|
|
|
seti_id integer not null,
|
|
|
|
seti_nresults integer not null,
|
|
|
|
seti_last_result_time integer not null,
|
|
|
|
seti_total_cpu double not null,
|
|
|
|
signature varchar(254),
|
2007-11-20 22:58:14 +00:00
|
|
|
-- deprecated
|
2011-09-21 21:26:00 +00:00
|
|
|
has_profile smallint not null,
|
|
|
|
cross_project_id varchar(254) not null,
|
|
|
|
passwd_hash varchar(254) not null,
|
|
|
|
email_validated smallint not null,
|
|
|
|
donated smallint not null,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table team (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
userid integer not null,
|
|
|
|
name varchar(254) not null,
|
|
|
|
name_lc varchar(254),
|
|
|
|
url varchar(254),
|
|
|
|
type integer not null,
|
|
|
|
name_html varchar(254),
|
|
|
|
description text,
|
|
|
|
nusers integer not null, /* temp */
|
|
|
|
country varchar(254),
|
|
|
|
total_credit double not null, /* temp */
|
|
|
|
expavg_credit double not null, /* temp */
|
|
|
|
expavg_time double not null,
|
|
|
|
seti_id integer not null,
|
|
|
|
ping_user integer not null default 0,
|
|
|
|
ping_time integer unsigned not null default 0,
|
|
|
|
joinable tinyint not null default 1,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table host (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
userid integer not null,
|
|
|
|
rpc_seqno integer not null,
|
|
|
|
rpc_time integer not null,
|
|
|
|
total_credit double not null,
|
|
|
|
expavg_credit double not null,
|
|
|
|
expavg_time double not null,
|
|
|
|
|
|
|
|
timezone integer not null,
|
|
|
|
domain_name varchar(254),
|
|
|
|
serialnum varchar(254),
|
|
|
|
last_ip_addr varchar(254),
|
|
|
|
nsame_ip_addr integer not null,
|
|
|
|
|
|
|
|
on_frac double not null,
|
|
|
|
connected_frac double not null,
|
|
|
|
active_frac double not null,
|
|
|
|
cpu_efficiency double not null,
|
|
|
|
duration_correction_factor double not null,
|
|
|
|
p_ncpus integer not null,
|
|
|
|
p_vendor varchar(254),
|
|
|
|
p_model varchar(254),
|
|
|
|
p_fpops double not null,
|
|
|
|
p_iops double not null,
|
|
|
|
p_membw double not null,
|
|
|
|
|
|
|
|
os_name varchar(254),
|
|
|
|
os_version varchar(254),
|
|
|
|
|
|
|
|
m_nbytes double not null,
|
|
|
|
m_cache double not null,
|
|
|
|
m_swap double not null,
|
|
|
|
|
|
|
|
d_total double not null,
|
|
|
|
d_free double not null,
|
|
|
|
d_boinc_used_total double not null,
|
|
|
|
d_boinc_used_project double not null,
|
|
|
|
d_boinc_max double not null,
|
|
|
|
|
|
|
|
n_bwup double not null,
|
|
|
|
n_bwdown double not null,
|
|
|
|
|
|
|
|
credit_per_cpu_sec double not null,
|
|
|
|
venue varchar(254) not null,
|
|
|
|
nresults_today integer not null,
|
|
|
|
avg_turnaround double not null,
|
|
|
|
host_cpid varchar(254),
|
|
|
|
external_ip_addr varchar(254),
|
|
|
|
max_results_day integer not null,
|
|
|
|
error_rate double not null default 0,
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
2010-03-29 22:28:20 +00:00
|
|
|
-- see comments in boinc_db.h
|
|
|
|
create table host_app_version (
|
2011-09-21 21:26:00 +00:00
|
|
|
host_id integer not null,
|
|
|
|
app_version_id integer not null,
|
|
|
|
pfc_n double not null,
|
|
|
|
pfc_avg double not null,
|
|
|
|
et_n double not null,
|
|
|
|
et_avg double not null,
|
|
|
|
et_var double not null,
|
|
|
|
et_q double not null,
|
|
|
|
max_jobs_per_day integer not null,
|
|
|
|
n_jobs_today integer not null,
|
|
|
|
turnaround_n double not null,
|
|
|
|
turnaround_avg double not null,
|
|
|
|
turnaround_var double not null,
|
|
|
|
turnaround_q double not null,
|
|
|
|
consecutive_valid integer not null
|
2010-03-29 22:28:20 +00:00
|
|
|
) engine = InnoDB;
|
|
|
|
|
2003-08-15 17:36:44 +00:00
|
|
|
/*
|
|
|
|
* Only information needed by the server or other backend components
|
|
|
|
* is broken out into separate fields.
|
|
|
|
* Other info, i.e. that needed by the client (files, etc.)
|
|
|
|
* is stored in the XML doc
|
|
|
|
*/
|
|
|
|
create table workunit (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
appid integer not null,
|
|
|
|
name varchar(254) not null,
|
|
|
|
xml_doc blob,
|
|
|
|
batch integer not null,
|
|
|
|
rsc_fpops_est double not null,
|
|
|
|
rsc_fpops_bound double not null,
|
|
|
|
rsc_memory_bound double not null,
|
|
|
|
rsc_disk_bound double not null,
|
|
|
|
need_validate smallint not null,
|
|
|
|
canonical_resultid integer not null,
|
|
|
|
canonical_credit double not null,
|
|
|
|
transition_time integer not null,
|
|
|
|
delay_bound integer not null,
|
|
|
|
error_mask integer not null,
|
|
|
|
file_delete_state integer not null,
|
|
|
|
assimilate_state integer not null,
|
|
|
|
hr_class integer not null,
|
|
|
|
opaque double not null,
|
|
|
|
min_quorum integer not null,
|
|
|
|
target_nresults integer not null,
|
|
|
|
max_error_results integer not null,
|
|
|
|
max_total_results integer not null,
|
|
|
|
max_success_results integer not null,
|
2012-01-30 22:39:13 +00:00
|
|
|
result_template_file varchar(63) not null,
|
2011-09-21 21:26:00 +00:00
|
|
|
priority integer not null,
|
|
|
|
mod_time timestamp,
|
|
|
|
rsc_bandwidth_bound double not null,
|
|
|
|
fileset_id integer not null,
|
|
|
|
app_version_id integer not null,
|
2012-01-30 22:39:13 +00:00
|
|
|
transitioner_flags tinyint not null,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
|
|
|
create table result (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
workunitid integer not null,
|
|
|
|
server_state integer not null,
|
|
|
|
outcome integer not null,
|
|
|
|
client_state integer not null,
|
|
|
|
hostid integer not null,
|
|
|
|
userid integer not null,
|
|
|
|
report_deadline integer not null,
|
|
|
|
sent_time integer not null,
|
|
|
|
received_time integer not null,
|
|
|
|
name varchar(254) not null,
|
|
|
|
cpu_time double not null,
|
|
|
|
xml_doc_in blob,
|
|
|
|
xml_doc_out blob,
|
|
|
|
stderr_out blob,
|
|
|
|
batch integer not null,
|
|
|
|
file_delete_state integer not null,
|
|
|
|
validate_state integer not null,
|
|
|
|
claimed_credit double not null,
|
|
|
|
granted_credit double not null,
|
|
|
|
opaque double not null,
|
|
|
|
random integer not null,
|
|
|
|
app_version_num integer not null,
|
|
|
|
appid integer not null,
|
|
|
|
exit_status integer not null,
|
|
|
|
teamid integer not null,
|
|
|
|
priority integer not null,
|
|
|
|
mod_time timestamp,
|
|
|
|
elapsed_time double not null,
|
|
|
|
flops_estimate double not null,
|
|
|
|
app_version_id integer not null,
|
|
|
|
runtime_outlier tinyint not null,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
2011-07-27 06:20:48 +00:00
|
|
|
-- see boinc_db.h for doc
|
|
|
|
create table batch (
|
2011-09-21 21:26:00 +00:00
|
|
|
id serial primary key,
|
|
|
|
user_id integer not null,
|
|
|
|
create_time integer not null,
|
|
|
|
logical_start_time double not null,
|
|
|
|
logical_end_time double not null,
|
|
|
|
est_completion_time double not null,
|
|
|
|
njobs integer not null,
|
|
|
|
fraction_done double not null,
|
|
|
|
nerror_jobs integer not null,
|
|
|
|
state integer not null,
|
|
|
|
completion_time double not null,
|
|
|
|
credit_estimate double not null,
|
|
|
|
credit_canonical double not null,
|
|
|
|
credit_total double not null,
|
|
|
|
name varchar(255) not null,
|
2012-06-05 05:57:55 +00:00
|
|
|
app_id integer not null,
|
|
|
|
project_state integer not null,
|
|
|
|
description varchar(255) not null
|
2011-07-27 06:20:48 +00:00
|
|
|
) engine = InnoDB;
|
|
|
|
|
|
|
|
-- permissions for job submission
|
|
|
|
--
|
|
|
|
create table user_submit (
|
2011-09-21 21:26:00 +00:00
|
|
|
user_id integer not null,
|
|
|
|
quota double not null,
|
|
|
|
logical_start_time double not null,
|
|
|
|
submit_all tinyint not null,
|
|
|
|
-- can submit jobs to any app
|
2011-09-22 03:15:21 +00:00
|
|
|
manage_all tinyint not null
|
2011-09-21 21:26:00 +00:00
|
|
|
-- manager privileges for all apps
|
|
|
|
-- grant/revoke permissions (except manage), change quotas
|
|
|
|
-- create apps
|
2011-07-27 06:20:48 +00:00
|
|
|
) engine = InnoDB;
|
|
|
|
|
|
|
|
-- (user, app) submit permissions
|
2011-09-21 21:26:00 +00:00
|
|
|
-- The existence of the record implies permission to submit jobs
|
2011-07-27 06:20:48 +00:00
|
|
|
--
|
|
|
|
create table user_submit_app (
|
2011-09-21 21:26:00 +00:00
|
|
|
user_id integer not null,
|
2011-09-22 03:15:21 +00:00
|
|
|
app_id integer not null,
|
2011-09-21 21:26:00 +00:00
|
|
|
manage tinyint not null
|
|
|
|
-- can
|
|
|
|
-- create/deprecated app versions of this app
|
|
|
|
-- grant/revoke permissions (except admin) this app
|
|
|
|
-- abort their jobs
|
2011-07-27 06:20:48 +00:00
|
|
|
) engine = InnoDB;
|
|
|
|
|
2008-02-21 00:47:50 +00:00
|
|
|
-- the following are used to implement trickle messages
|
|
|
|
|
2004-06-22 22:56:50 +00:00
|
|
|
create table msg_from_host (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
hostid integer not null,
|
|
|
|
variety varchar(254) not null,
|
|
|
|
handled smallint not null,
|
|
|
|
xml mediumtext,
|
2004-01-04 06:48:40 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2004-01-04 06:48:40 +00:00
|
|
|
|
2004-06-22 22:56:50 +00:00
|
|
|
create table msg_to_host (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
hostid integer not null,
|
|
|
|
variety varchar(254) not null,
|
|
|
|
handled smallint not null,
|
|
|
|
xml mediumtext,
|
2004-03-18 18:08:35 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2004-03-18 18:08:35 +00:00
|
|
|
|
2008-02-21 00:47:50 +00:00
|
|
|
-- An assignment of a WU to a specific host, user, or team, or to all hosts
|
|
|
|
--
|
|
|
|
create table assignment (
|
2011-09-21 21:26:00 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
create_time integer not null,
|
|
|
|
target_id integer not null,
|
2008-02-21 00:47:50 +00:00
|
|
|
-- ID of target entity (see below)
|
2011-09-21 21:26:00 +00:00
|
|
|
target_type integer not null,
|
2008-02-21 00:47:50 +00:00
|
|
|
-- 0=none, 1=host, 2=user, 3=team
|
2011-09-21 21:26:00 +00:00
|
|
|
multi tinyint not null,
|
2012-02-22 22:13:08 +00:00
|
|
|
-- 0=normal replication, 1=all hosts in set
|
2011-09-21 21:26:00 +00:00
|
|
|
workunitid integer not null,
|
|
|
|
resultid integer not null,
|
2008-02-21 00:47:50 +00:00
|
|
|
-- if not multi, the result
|
2012-01-30 22:39:13 +00:00
|
|
|
-- deprecated
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2008-02-21 00:47:50 +00:00
|
|
|
) engine = InnoDB;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
2003-11-30 21:05:57 +00:00
|
|
|
-- EVERYTHING FROM HERE ON IS USED ONLY FROM PHP,
|
|
|
|
-- SO NOT IN BOINC_DB.H ETC.
|
|
|
|
|
|
|
|
-- user profile (description, pictures)
|
|
|
|
--
|
2003-08-15 17:36:44 +00:00
|
|
|
create table profile (
|
2011-09-21 21:26:00 +00:00
|
|
|
userid integer not null,
|
|
|
|
language varchar(254),
|
|
|
|
response1 text,
|
|
|
|
response2 text,
|
|
|
|
has_picture smallint not null,
|
|
|
|
recommend integer not null,
|
|
|
|
reject integer not null,
|
|
|
|
posts integer not null,
|
|
|
|
uotd_time integer,
|
|
|
|
verification integer not null,
|
2004-03-24 22:53:47 +00:00
|
|
|
-- UOD screening status: -1 denied, 0 unrated, 1 approved
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (userid)
|
2009-05-26 16:56:00 +00:00
|
|
|
) engine=MyISAM;
|
2003-08-15 17:36:44 +00:00
|
|
|
|
2003-11-30 21:05:57 +00:00
|
|
|
-- message board category
|
|
|
|
-- help desk is a group of categories that are handled separately
|
|
|
|
--
|
|
|
|
create table category (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
orderID integer not null,
|
2003-11-30 21:05:57 +00:00
|
|
|
-- order in which to display
|
2011-09-22 03:15:21 +00:00
|
|
|
lang integer not null,
|
2007-11-10 00:32:42 +00:00
|
|
|
-- not used
|
2011-09-22 03:15:21 +00:00
|
|
|
name varchar(254) binary,
|
|
|
|
is_helpdesk smallint not null,
|
2003-11-30 21:05:57 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-11-30 21:05:57 +00:00
|
|
|
|
|
|
|
-- message board topic
|
|
|
|
--
|
|
|
|
create table forum (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
category integer not null,
|
2007-11-10 00:32:42 +00:00
|
|
|
-- ID of entity to which this forum is attached.
|
|
|
|
-- The type (table) of the entity is determined by parent_type
|
2011-09-22 03:15:21 +00:00
|
|
|
orderID integer not null,
|
|
|
|
title varchar(254) not null,
|
|
|
|
description varchar(254) not null,
|
|
|
|
timestamp integer not null,
|
2003-12-08 01:19:49 +00:00
|
|
|
-- time of last new or modified thread or post
|
2011-09-22 03:15:21 +00:00
|
|
|
threads integer not null,
|
2007-11-10 00:32:42 +00:00
|
|
|
-- number of non-hidden threads in forum
|
2011-09-22 03:15:21 +00:00
|
|
|
posts integer not null,
|
|
|
|
rate_min_expavg_credit integer not null,
|
|
|
|
rate_min_total_credit integer not null,
|
|
|
|
post_min_interval integer not null,
|
|
|
|
post_min_expavg_credit integer not null,
|
|
|
|
post_min_total_credit integer not null,
|
|
|
|
is_dev_blog tinyint not null default 0,
|
|
|
|
parent_type integer not null,
|
2007-11-12 16:00:37 +00:00
|
|
|
-- entity type to which this forum is attached:
|
|
|
|
-- 0 == category (public)
|
|
|
|
-- 1 == team
|
|
|
|
-- 2 == group
|
2003-11-30 21:05:57 +00:00
|
|
|
primary key (id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2003-11-30 21:05:57 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
-- threads in a topic (or questions)
|
2003-11-30 21:05:57 +00:00
|
|
|
--
|
2003-08-15 17:36:44 +00:00
|
|
|
create table thread (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
forum integer not null,
|
|
|
|
owner integer not null,
|
2010-01-29 16:28:46 +00:00
|
|
|
-- user ID of creator
|
2011-09-22 03:15:21 +00:00
|
|
|
status integer not null,
|
2011-02-28 19:02:59 +00:00
|
|
|
-- whether a question has been answered
|
2011-06-14 05:42:52 +00:00
|
|
|
-- News forum: if set, don't export as notice
|
2011-09-22 03:15:21 +00:00
|
|
|
title varchar(254) not null,
|
|
|
|
timestamp integer not null,
|
2003-12-08 01:19:49 +00:00
|
|
|
-- time of last new or modified post
|
2011-09-22 03:15:21 +00:00
|
|
|
views integer not null,
|
2003-11-30 21:05:57 +00:00
|
|
|
-- number of times this has been viewed
|
2011-09-22 03:15:21 +00:00
|
|
|
replies integer not null,
|
2007-11-10 00:32:42 +00:00
|
|
|
-- number of non-hidden posts in thread, not counting the initial one
|
2011-09-22 03:15:21 +00:00
|
|
|
activity double not null,
|
2003-12-21 05:55:48 +00:00
|
|
|
-- for questions: number of askers / time since asked
|
2003-12-31 23:09:21 +00:00
|
|
|
-- (set periodically by update_forum_activity.php)
|
2011-09-22 03:15:21 +00:00
|
|
|
sufferers integer not null,
|
2003-11-30 21:05:57 +00:00
|
|
|
-- in help desk: # people who indicated they had same problem
|
2011-09-22 03:15:21 +00:00
|
|
|
score double not null,
|
|
|
|
votes integer not null,
|
|
|
|
create_time integer not null,
|
2003-12-08 01:19:49 +00:00
|
|
|
-- when this record was created
|
2011-09-22 03:15:21 +00:00
|
|
|
hidden integer not null,
|
2005-01-13 23:06:15 +00:00
|
|
|
-- nonzero if hidden by moderators
|
2011-09-22 03:15:21 +00:00
|
|
|
sticky tinyint not null default 0,
|
|
|
|
locked tinyint not null default 0,
|
2003-08-15 17:36:44 +00:00
|
|
|
primary key (id)
|
2009-05-26 16:56:00 +00:00
|
|
|
) engine=MyISAM;
|
2003-11-30 21:05:57 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
-- postings in a thread (or answers)
|
2003-11-30 21:05:57 +00:00
|
|
|
-- Each thread has an initial post
|
|
|
|
--
|
|
|
|
create table post (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
thread integer not null,
|
|
|
|
user integer not null,
|
|
|
|
timestamp integer not null,
|
2003-12-08 01:19:49 +00:00
|
|
|
-- create time
|
2011-09-22 03:15:21 +00:00
|
|
|
content text not null,
|
|
|
|
modified integer not null,
|
2003-11-30 21:05:57 +00:00
|
|
|
-- when last modified
|
2011-09-22 03:15:21 +00:00
|
|
|
parent_post integer not null,
|
2003-12-08 01:19:49 +00:00
|
|
|
-- post that was replied to, if any
|
2011-09-22 03:15:21 +00:00
|
|
|
score double not null,
|
|
|
|
votes integer not null,
|
|
|
|
signature tinyint not null default 0,
|
|
|
|
hidden integer not null,
|
2005-01-13 23:06:15 +00:00
|
|
|
-- nonzero if hidden by moderators
|
2003-11-30 21:05:57 +00:00
|
|
|
primary key (id)
|
2009-05-26 16:56:00 +00:00
|
|
|
) engine=MyISAM;
|
2003-11-30 21:05:57 +00:00
|
|
|
|
2003-12-02 22:04:26 +00:00
|
|
|
-- subscription to a thread
|
|
|
|
--
|
|
|
|
create table subscriptions (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null,
|
|
|
|
threadid integer not null,
|
|
|
|
notified_time integer not null default 0
|
2007-12-30 22:02:16 +00:00
|
|
|
-- deprecated
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=InnoDB;
|
2004-09-04 23:37:49 +00:00
|
|
|
|
2007-12-30 22:02:16 +00:00
|
|
|
-- actually: prefs for all community features
|
|
|
|
--
|
2004-09-04 23:37:49 +00:00
|
|
|
create table forum_preferences (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null default 0,
|
|
|
|
signature varchar(254) not null default '',
|
|
|
|
posts integer not null default 0,
|
|
|
|
last_post integer not null,
|
|
|
|
avatar varchar(254) not null default '',
|
|
|
|
hide_avatars tinyint not null default 0,
|
|
|
|
forum_sorting integer not null,
|
|
|
|
thread_sorting integer not null,
|
|
|
|
no_signature_by_default tinyint not null default 1,
|
|
|
|
images_as_links tinyint not null default 0,
|
|
|
|
link_popup tinyint not null default 0,
|
|
|
|
mark_as_read_timestamp integer not null default 0,
|
|
|
|
special_user char(12) not null default '0',
|
|
|
|
jump_to_unread tinyint not null default 1,
|
|
|
|
hide_signatures tinyint not null default 0,
|
|
|
|
rated_posts varchar(254) not null,
|
|
|
|
low_rating_threshold integer not null default -25,
|
2009-09-29 21:58:54 +00:00
|
|
|
-- deprecated
|
2011-09-22 03:15:21 +00:00
|
|
|
high_rating_threshold integer not null default 5,
|
2009-09-29 21:58:54 +00:00
|
|
|
-- deprecated
|
2011-09-22 03:15:21 +00:00
|
|
|
minimum_wrap_postcount integer DEFAULT 100 NOT NULL,
|
|
|
|
display_wrap_postcount integer DEFAULT 75 NOT NULL,
|
|
|
|
ignorelist varchar(254) not null,
|
|
|
|
ignore_sticky_posts tinyint not null default 0,
|
|
|
|
banished_until integer not null default 0,
|
|
|
|
pm_notification tinyint not null default 0,
|
2007-12-30 22:02:16 +00:00
|
|
|
-- actually controls all notifications.
|
|
|
|
-- 0 = no email
|
|
|
|
-- 1 = email per event
|
|
|
|
-- 2 = digest email
|
2011-09-22 03:15:21 +00:00
|
|
|
highlight_special tinyint not null default 1,
|
2004-09-04 23:37:49 +00:00
|
|
|
primary key (userid)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2004-09-04 23:37:49 +00:00
|
|
|
|
2007-11-10 00:32:42 +00:00
|
|
|
-- keep track of last time a user read a thread
|
2004-09-04 23:37:49 +00:00
|
|
|
create table forum_logging (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null default 0,
|
|
|
|
threadid integer not null default 0,
|
|
|
|
timestamp integer not null default 0,
|
2004-09-04 23:37:49 +00:00
|
|
|
primary key (userid,threadid)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2006-07-01 20:03:48 +00:00
|
|
|
|
|
|
|
create table post_ratings (
|
2011-09-22 03:15:21 +00:00
|
|
|
post integer not null,
|
|
|
|
user integer not null,
|
|
|
|
rating tinyint not null,
|
2006-07-01 20:03:48 +00:00
|
|
|
primary key(post, user)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-04-11 18:05:26 +00:00
|
|
|
|
|
|
|
create table sent_email (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null,
|
|
|
|
time_sent integer not null,
|
|
|
|
email_type smallint not null,
|
2007-04-11 18:05:26 +00:00
|
|
|
-- 0 = other
|
|
|
|
-- 1 = newsletter
|
|
|
|
-- 2 = lapsed reminder
|
|
|
|
-- 3 = failed reminder
|
|
|
|
-- 4 = forum post hide
|
|
|
|
-- 5 = forum ban
|
|
|
|
-- 6 = fundraising appeal
|
|
|
|
primary key(userid)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-04-29 14:22:28 +00:00
|
|
|
|
|
|
|
create table private_messages (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
userid integer not null,
|
|
|
|
senderid integer not null,
|
|
|
|
date integer not null,
|
|
|
|
opened tinyint not null default 0,
|
|
|
|
subject varchar(255) not null,
|
|
|
|
content text not null,
|
2007-04-29 14:22:28 +00:00
|
|
|
primary key(id),
|
|
|
|
key userid (userid)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-05-02 18:51:51 +00:00
|
|
|
|
2007-05-02 23:17:52 +00:00
|
|
|
create table credited_job (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null,
|
|
|
|
workunitid bigint not null
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-05-27 17:33:06 +00:00
|
|
|
|
|
|
|
create table donation_items (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
item_name varchar(32) not null,
|
|
|
|
title varchar(255) not null,
|
|
|
|
description varchar(255) not null,
|
|
|
|
required double not null default '0',
|
2007-05-27 17:33:06 +00:00
|
|
|
PRIMARY KEY(id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-05-27 17:33:06 +00:00
|
|
|
|
|
|
|
create table donation_paypal (
|
2011-09-22 03:15:21 +00:00
|
|
|
id integer not null auto_increment,
|
|
|
|
order_time integer not null,
|
|
|
|
userid integer not null,
|
|
|
|
email_addr varchar(255) not null,
|
|
|
|
order_amount double(6,2) not null,
|
|
|
|
processed tinyint not null default '0',
|
|
|
|
payment_time integer not null,
|
|
|
|
item_name varchar(255) not null,
|
|
|
|
item_number varchar(255) not null,
|
|
|
|
payment_status varchar(255) not null,
|
|
|
|
payment_amount double(6,2) not null,
|
|
|
|
payment_fee double(5,2) default null,
|
|
|
|
payment_currency varchar(255) not null,
|
|
|
|
txn_id varchar(255) not null,
|
|
|
|
receiver_email varchar(255) not null,
|
|
|
|
payer_email varchar(255) not null,
|
|
|
|
payer_name varchar(255) not null,
|
2007-05-27 17:33:06 +00:00
|
|
|
PRIMARY KEY(id)
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-07-27 18:30:10 +00:00
|
|
|
|
|
|
|
-- record changes in team membership
|
|
|
|
create table team_delta (
|
2011-09-22 03:15:21 +00:00
|
|
|
userid integer not null,
|
|
|
|
teamid integer not null,
|
|
|
|
timestamp integer not null,
|
|
|
|
joining tinyint not null,
|
|
|
|
total_credit double not null
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-10-19 20:01:36 +00:00
|
|
|
|
|
|
|
-- tables for moderator banishment votes
|
|
|
|
create table banishment_vote (
|
2011-09-22 03:15:21 +00:00
|
|
|
id serial primary key,
|
|
|
|
userid integer not null,
|
|
|
|
modid integer not null,
|
|
|
|
start_time integer not null,
|
|
|
|
end_time integer not null
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-10-19 20:01:36 +00:00
|
|
|
|
|
|
|
create table banishment_votes (
|
2011-09-22 03:15:21 +00:00
|
|
|
id serial primary key,
|
|
|
|
voteid integer not null,
|
|
|
|
modid integer not null,
|
|
|
|
time integer not null,
|
|
|
|
yes tinyint not null
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-11-03 04:26:47 +00:00
|
|
|
|
|
|
|
create table team_admin (
|
2011-09-22 03:15:21 +00:00
|
|
|
teamid integer not null,
|
|
|
|
userid integer not null,
|
|
|
|
create_time integer not null,
|
|
|
|
rights integer not null
|
2007-12-21 23:39:25 +00:00
|
|
|
) engine=MyISAM;
|
2007-12-18 20:28:08 +00:00
|
|
|
|
|
|
|
-- A friendship request.
|
|
|
|
-- The friendship exists if (x,y) and (y,x)
|
|
|
|
create table friend (
|
2011-09-22 03:15:21 +00:00
|
|
|
user_src integer not null,
|
2007-12-18 20:28:08 +00:00
|
|
|
-- initiator
|
2011-09-22 03:15:21 +00:00
|
|
|
user_dest integer not null,
|
2007-12-18 20:28:08 +00:00
|
|
|
-- target
|
2011-09-22 03:15:21 +00:00
|
|
|
message varchar(255) not null,
|
|
|
|
create_time integer not null,
|
|
|
|
reciprocated tinyint not null
|
2007-12-18 20:28:08 +00:00
|
|
|
-- whether the reciprocal exists
|
|
|
|
);
|
|
|
|
|
|
|
|
-- a notification of something, e.g.
|
|
|
|
-- a friend request or confirmation
|
|
|
|
-- a post in a subscribed thread
|
|
|
|
-- a personal message
|
|
|
|
-- These records are deleted when the user acts on them
|
|
|
|
create table notify (
|
2011-09-22 03:15:21 +00:00
|
|
|
id serial primary key,
|
|
|
|
userid integer not null,
|
2007-12-18 20:28:08 +00:00
|
|
|
-- destination of notification
|
2011-09-22 03:15:21 +00:00
|
|
|
create_time integer not null,
|
|
|
|
type integer not null,
|
|
|
|
opaque integer not null
|
2007-12-18 20:28:08 +00:00
|
|
|
-- some other ID, e.g. that of the thread, user or PM record
|
|
|
|
);
|