updated schema. combined schema into schema.sql

svn path=/trunk/boinc/; revision=1783
This commit is contained in:
Karl Chen 2003-07-24 00:30:47 +00:00
parent 63221907a5
commit 1d09e8d7cf
4 changed files with 271 additions and 192 deletions

View File

@ -1,6 +1,8 @@
#! /bin/tcsh #!/bin/sh
sed -e s/BOINC_DB_NAME/$BOINC_DB_NAME/g drop.sql | mysql if [ -z "$1" ]; then
sed -e s/BOINC_DB_NAME/$BOINC_DB_NAME/g schema.sql | mysql echo "syntax: $0 DB_NAME"
sed -e s/BOINC_DB_NAME/$BOINC_DB_NAME/g constraints.sql | mysql exit 1
fi
mysql $1 < schema.sql

View File

@ -1,202 +1,279 @@
create table project ( CREATE TABLE `app` (
id integer not null auto_increment, `id` int(11) NOT NULL auto_increment,
short_name varchar(254) not null, `create_time` int(11) NOT NULL default '0',
long_name varchar(254) not null, `name` varchar(254) NOT NULL default '',
primary key (id) `min_version` int(11) NOT NULL default '0',
); PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) TYPE=MyISAM;
create table platform ( CREATE TABLE `app_version` (
id integer not null auto_increment, `id` int(11) NOT NULL auto_increment,
create_time integer not null, `create_time` int(11) NOT NULL default '0',
name varchar(254) not null, `appid` int(11) NOT NULL default '0',
user_friendly_name varchar(254) not null, `version_num` int(11) NOT NULL default '0',
primary key (id) `platformid` int(11) NOT NULL default '0',
); `xml_doc` blob,
`min_core_version` int(11) NOT NULL default '0',
`max_core_version` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `appid` (`appid`,`platformid`,`version_num`)
) TYPE=MyISAM;
create table core_version ( CREATE TABLE `category` (
id integer not null auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
create_time integer not null, `orderID` int(10) unsigned NOT NULL default '0',
version_num integer not null, `lang` int(10) unsigned NOT NULL default '0',
platformid integer not null, `name` varchar(255) binary NOT NULL default '',
xml_doc blob, PRIMARY KEY (`id`),
message varchar(254), UNIQUE KEY `langID` (`lang`,`orderID`)
deprecated smallint not null, ) TYPE=MyISAM;
primary key (id)
);
create table app ( CREATE TABLE `core_version` (
id integer not null auto_increment, `id` int(11) NOT NULL auto_increment,
create_time integer not null, `create_time` int(11) NOT NULL default '0',
name varchar(254) not null, `version_num` int(11) NOT NULL default '0',
min_version integer not null, `platformid` int(11) NOT NULL default '0',
primary key (id) `xml_doc` blob,
); `message` varchar(254) default NULL,
`deprecated` smallint(6) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
create table app_version ( CREATE TABLE `forum` (
id integer not null auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
create_time integer not null, `category` int(10) unsigned NOT NULL default '0',
appid integer not null, `orderID` int(10) unsigned NOT NULL default '0',
version_num integer not null, `title` varchar(254) NOT NULL default '',
platformid integer not null, `description` varchar(254) NOT NULL default '',
xml_doc blob, `timestamp` int(10) unsigned NOT NULL default '0',
min_core_version integer not null, `threads` int(10) unsigned NOT NULL default '0',
max_core_version integer not null, `posts` int(10) unsigned NOT NULL default '0',
primary key (id) PRIMARY KEY (`id`),
); UNIQUE KEY `orderID` (`orderID`,`category`)
) TYPE=MyISAM;
create table user ( CREATE TABLE `host` (
id integer not null auto_increment, `id` int(11) NOT NULL auto_increment,
create_time integer not null, `create_time` int(11) NOT NULL default '0',
email_addr varchar(254) not null, `userid` int(11) NOT NULL default '0',
name varchar(254), `rpc_seqno` int(11) NOT NULL default '0',
authenticator varchar(254), `rpc_time` int(11) NOT NULL default '0',
country varchar(254), `total_credit` double NOT NULL default '0',
postal_code varchar(254), `expavg_credit` double NOT NULL default '0',
total_credit double not null, `expavg_time` double NOT NULL default '0',
expavg_credit double not null, `timezone` int(11) NOT NULL default '0',
expavg_time double not null, `domain_name` varchar(254) default NULL,
global_prefs blob, `serialnum` varchar(254) default NULL,
project_prefs blob, `last_ip_addr` varchar(254) default NULL,
teamid integer not null, `nsame_ip_addr` int(11) NOT NULL default '0',
venue varchar(254) not null, `on_frac` double NOT NULL default '0',
url varchar(254), `connected_frac` double NOT NULL default '0',
send_email smallint not null, `active_frac` double NOT NULL default '0',
show_hosts smallint not null, `p_ncpus` int(11) NOT NULL default '0',
primary key (id) `p_vendor` varchar(254) default NULL,
); `p_model` varchar(254) default NULL,
`p_fpops` double NOT NULL default '0',
`p_iops` double NOT NULL default '0',
`p_membw` double NOT NULL default '0',
`os_name` varchar(254) default NULL,
`os_version` varchar(254) default NULL,
`m_nbytes` double NOT NULL default '0',
`m_cache` double NOT NULL default '0',
`m_swap` double NOT NULL default '0',
`d_total` double NOT NULL default '0',
`d_free` double NOT NULL default '0',
`d_boinc_used_total` double NOT NULL default '0',
`d_boinc_used_project` double NOT NULL default '0',
`d_boinc_max` double NOT NULL default '0',
`n_bwup` double NOT NULL default '0',
`n_bwdown` double NOT NULL default '0',
`credit_per_cpu_sec` double NOT NULL default '0',
`venue` varchar(254) NOT NULL default '',
`projects` blob,
PRIMARY KEY (`id`),
KEY `host_user` (`userid`),
KEY `host_avg` (`expavg_credit`),
KEY `host_tot` (`total_credit`)
) TYPE=MyISAM;
create table team ( CREATE TABLE `lang` (
id integer not null auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
create_time integer not null, `name` varchar(254) NOT NULL default '',
userid integer not null, `charset` varchar(254) NOT NULL default '',
name varchar(254) not null, PRIMARY KEY (`id`)
name_lc varchar(254), ) TYPE=MyISAM;
url varchar(254),
type integer not null,
name_html varchar(254),
description blob,
nusers integer not null, /* temp */
country varchar(254),
total_credit double not null, /* temp */
expavg_credit double not null, /* temp */
primary key (id)
);
CREATE TABLE `platform` (
`id` int(11) NOT NULL auto_increment,
`create_time` int(11) NOT NULL default '0',
`name` varchar(254) NOT NULL default '',
`user_friendly_name` varchar(254) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) TYPE=MyISAM;
create table host ( CREATE TABLE `post` (
id integer not null auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
create_time integer not null, `thread` int(10) unsigned NOT NULL default '0',
userid integer not null, `user` int(10) unsigned NOT NULL default '0',
rpc_seqno integer not null, `timestamp` int(10) unsigned NOT NULL default '0',
rpc_time integer not null, `content` text NOT NULL,
total_credit double not null, `modified` int(10) unsigned default NULL,
expavg_credit double not null, `parent_post` int(10) unsigned default NULL,
expavg_time double not null, PRIMARY KEY (`id`),
KEY `threadID` (`thread`),
KEY `userID` (`user`),
FULLTEXT KEY `content` (`content`)
) TYPE=MyISAM;
timezone integer not null, CREATE TABLE `profile` (
domain_name varchar(254), `userid` int(11) NOT NULL default '0',
serialnum varchar(254), `language` varchar(30) default NULL,
last_ip_addr varchar(254), `response1` text,
nsame_ip_addr integer not null, `response2` text,
`has_picture` tinyint(1) NOT NULL default '0',
`recommend` int(11) NOT NULL default '0',
`reject` int(11) NOT NULL default '0',
`posts` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`userid`)
) TYPE=MyISAM;
on_frac double not null, CREATE TABLE `project` (
connected_frac double not null, `id` int(11) NOT NULL auto_increment,
active_frac double not null, `short_name` varchar(254) NOT NULL default '',
`long_name` varchar(254) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
p_ncpus integer not null, CREATE TABLE `result` (
p_vendor varchar(254), `id` int(11) NOT NULL auto_increment,
p_model varchar(254), `create_time` int(11) NOT NULL default '0',
p_fpops double not null, `workunitid` int(11) NOT NULL default '0',
p_iops double not null, `server_state` int(11) NOT NULL default '0',
p_membw double not null, `outcome` int(11) NOT NULL default '0',
`client_state` int(11) NOT NULL default '0',
`hostid` int(11) NOT NULL default '0',
`report_deadline` int(11) NOT NULL default '0',
`sent_time` int(11) NOT NULL default '0',
`received_time` int(11) NOT NULL default '0',
`name` varchar(254) NOT NULL default '',
`cpu_time` double NOT NULL default '0',
`xml_doc_in` blob,
`xml_doc_out` blob,
`stderr_out` blob,
`batch` int(11) NOT NULL default '0',
`file_delete_state` int(11) NOT NULL default '0',
`validate_state` int(11) NOT NULL default '0',
`claimed_credit` double NOT NULL default '0',
`granted_credit` double NOT NULL default '0',
`opaque` int(11) NOT NULL default '0',
`random` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `res_wuid` (`workunitid`),
KEY `ind_res_st` (`server_state`,`random`),
KEY `res_filedel` (`file_delete_state`),
KEY `res_hostid` (`hostid`),
KEY `received_time` (`received_time`)
) TYPE=MyISAM;
os_name varchar(254), CREATE TABLE `team` (
os_version varchar(254), `id` int(11) NOT NULL auto_increment,
`create_time` int(11) NOT NULL default '0',
`userid` int(11) NOT NULL default '0',
`name` varchar(254) NOT NULL default '',
`name_lc` varchar(254) default NULL,
`url` varchar(254) default NULL,
`type` int(11) NOT NULL default '0',
`name_html` varchar(254) default NULL,
`description` blob,
`nusers` int(11) NOT NULL default '0',
`country` varchar(254) default NULL,
`total_credit` double NOT NULL default '0',
`expavg_credit` double NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `team_avg` (`expavg_credit`),
KEY `team_tot` (`total_credit`)
) TYPE=MyISAM;
m_nbytes double not null, CREATE TABLE `thread` (
m_cache double not null, `id` int(10) unsigned NOT NULL auto_increment,
m_swap double not null, `forum` int(10) unsigned NOT NULL default '0',
`owner` int(10) unsigned NOT NULL default '0',
`title` varchar(254) NOT NULL default '',
`timestamp` int(10) unsigned NOT NULL default '0',
`views` int(10) unsigned NOT NULL default '0',
`replies` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `forumID` (`forum`)
) TYPE=MyISAM;
d_total double not null, CREATE TABLE `user` (
d_free double not null, `id` int(11) NOT NULL auto_increment,
d_boinc_used_total double not null, `create_time` int(11) NOT NULL default '0',
d_boinc_used_project double not null, `email_addr` varchar(254) NOT NULL default '',
d_boinc_max double not null, `name` varchar(254) default NULL,
`authenticator` varchar(254) default NULL,
`country` varchar(254) default NULL,
`postal_code` varchar(254) default NULL,
`total_credit` double NOT NULL default '0',
`expavg_credit` double NOT NULL default '0',
`expavg_time` double NOT NULL default '0',
`global_prefs` blob,
`project_prefs` blob,
`teamid` int(11) NOT NULL default '0',
`venue` varchar(254) NOT NULL default '',
`url` varchar(254) default NULL,
`send_email` smallint(6) NOT NULL default '0',
`show_hosts` smallint(6) NOT NULL default '0',
`posts` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `email_addr` (`email_addr`),
UNIQUE KEY `authenticator` (`authenticator`),
KEY `ind_tid` (`teamid`),
KEY `user_tot` (`total_credit`),
KEY `user_avg` (`expavg_credit`)
) TYPE=MyISAM;
n_bwup double not null, CREATE TABLE `workseq` (
n_bwdown double not null, `id` int(11) NOT NULL auto_increment,
`create_time` int(11) NOT NULL default '0',
`state` int(11) NOT NULL default '0',
`hostid` int(11) NOT NULL default '0',
`wuid_last_done` int(11) NOT NULL default '0',
`wuid_last_sent` int(11) NOT NULL default '0',
`workseqid_master` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
credit_per_cpu_sec double not null, CREATE TABLE `workunit` (
venue varchar(254) not null, `id` int(11) NOT NULL auto_increment,
projects blob, `create_time` int(11) NOT NULL default '0',
`appid` int(11) NOT NULL default '0',
primary key (id) `name` varchar(254) NOT NULL default '',
); `xml_doc` blob,
`batch` int(11) NOT NULL default '0',
/* `rsc_fpops` double NOT NULL default '0',
* Only information needed by the server or other backend components `rsc_iops` double NOT NULL default '0',
* is broken out into separate fields. `rsc_memory` double NOT NULL default '0',
* Other info, i.e. that needed by the client (files, etc.) `rsc_disk` double NOT NULL default '0',
* is stored in the XML doc `need_validate` smallint(6) NOT NULL default '0',
*/ `canonical_resultid` int(11) NOT NULL default '0',
create table workunit ( `canonical_credit` double NOT NULL default '0',
id integer not null auto_increment, `timeout_check_time` int(11) NOT NULL default '0',
create_time integer not null, `delay_bound` int(11) NOT NULL default '0',
appid integer not null, `error_mask` int(11) NOT NULL default '0',
name varchar(254) not null, `file_delete_state` int(11) NOT NULL default '0',
xml_doc blob, `assimilate_state` int(11) NOT NULL default '0',
batch integer not null, `workseq_next` int(11) NOT NULL default '0',
rsc_fpops double not null, `opaque` int(11) NOT NULL default '0',
rsc_iops double not null, PRIMARY KEY (`id`),
rsc_memory double not null, UNIQUE KEY `name` (`name`),
rsc_disk double not null, KEY `wu_val` (`appid`,`need_validate`),
need_validate smallint not null, KEY `wu_timeout` (`appid`,`timeout_check_time`),
canonical_resultid integer not null, KEY `wu_filedel` (`file_delete_state`),
canonical_credit double not null, KEY `wu_assim` (`appid`,`assimilate_state`)
timeout_check_time integer not null, ) TYPE=MyISAM;
delay_bound integer not null,
error_mask integer not null,
file_delete_state integer not null,
assimilate_state integer not null,
workseq_next integer not null,
opaque integer not null,
primary key (id)
);
create table result (
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,
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 integer not null,
random integer not null,
primary key (id)
);
create table workseq (
id integer not null auto_increment,
create_time integer not null,
state integer not null,
hostid integer not null,
wuid_last_done integer not null,
wuid_last_sent integer not null,
workseqid_master integer not null,
primary key (id)
);

View File

@ -418,7 +418,7 @@ class Project:
verbose_echo(1, "Setting up database") verbose_echo(1, "Setting up database")
self.create_db() self.create_db()
map(self.run_db_script, [ 'schema.sql', 'constraints.sql' ]) map(self.run_db_script, [ 'schema.sql' ])
db = self.db_open() db = self.db_open()
db.query("insert into project(short_name, long_name) values('%s', '%s')" %( db.query("insert into project(short_name, long_name) values('%s', '%s')" %(

View File

@ -49,7 +49,7 @@ def test_init():
options.echo_verbose = int(get_env_var("BOINC_TEST_VERBOSE", '1')) options.echo_verbose = int(get_env_var("BOINC_TEST_VERBOSE", '1'))
options.proxy_port = 16000 + (os.getpid() % 1000) options.proxy_port = 16000 + (os.getpid() % 1000)
options.drop_db_first = True options.drop_db_first = True
if options.auto_setup: if options.auto_setup:
options.auto_setup_basedir = 'run-%d'%os.getpid() options.auto_setup_basedir = 'run-%d'%os.getpid()
verbose_echo(0, "Creating testbed in %s"%options.auto_setup_basedir) verbose_echo(0, "Creating testbed in %s"%options.auto_setup_basedir)
@ -239,7 +239,7 @@ class TestProject(Project):
gp = '' gp = ''
db.query(("insert into user values (0, %d, '%s', '%s', '%s', " + db.query(("insert into user values (0, %d, '%s', '%s', '%s', " +
"'Peru', '12345', 0, 0, 0, '%s', '%s', 0, 'home', '', 0, 1)") % ( "'Peru', '12345', 0, 0, 0, '%s', '%s', 0, 'home', '', 0, 1, 0)") % (
time.time(), time.time(),
user.email_addr, user.email_addr,
user.name, user.name,