# MS-SQL Server database creation template
# This is a template for install.php -- not for creating the database!
#
# $Id: mssql.in,v 1.1 2005/07/19 19:46:50 ulferikson Exp $
CREATE TABLE TBL_ATTACHMENT (
attachment_id id smallint NOT NULL default '0',
bug_id smallint NOT NULL default '0',
file_name char(255) NOT NULL default '',
description char(255) NOT NULL default '',
file_size int NOT NULL default '0',
mime_type char(30) NOT NULL default '',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (attachment_id)
);
CREATE TABLE TBL_AUTH_GROUP (
group_id smallint NOT NULL default '0',
group_name varchar(80) NOT NULL default '',
locked bit NOT NULL default '0',
assignable bit NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (group_id)
);
CREATE TABLE TBL_AUTH_PERM (
perm_id smallint NOT NULL default '0',
perm_name varchar(80) NOT NULL default '',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (perm_id)
);
CREATE TABLE TBL_AUTH_USER (
user_id smallint NOT NULL default '0',
login char(40) NOT NULL default '',
first_name char(40) NOT NULL default '',
last_name char(40) NOT NULL default '',
email char(60) NOT NULL default '',
password char(40) NOT NULL default '',
active tinyint NOT NULL default '1',
bug_list_fields text NOT NULL default '',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (user_id),
UNIQUE login (login)
);
CREATE TABLE TBL_BUG (
bug_id smallint NOT NULL default '0',
title varchar(100) NOT NULL default '',
description text NOT NULL,
url varchar(255) NOT NULL default '',
severity_id tinyint NOT NULL default '0',
priority tinyint NOT NULL default '0',
status_id tinyint NOT NULL default '0',
resolution_id tinyint NOT NULL default '0',
database_id tinyint NOT NULL default '0',
site_id tinyint NOT NULL default '0',
assigned_to smallint NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
project_id smallint NOT NULL default '0',
version_id smallint NOT NULL default '0',
component_id smallint NOT NULL default '0',
os_id tinyint NOT NULL default '0',
browser_string varchar(255) NOT NULL default '',
close_date int NOT NULL default '0',
closed_in_version_id smallint NOT NULL default '0',
to_be_closed_in_version_id smallint NOT NULL default '0',
PRIMARY KEY (bug_id)
);
CREATE TABLE TBL_BUG_CC (
bug_id smallint NOT NULL default '0',
user_id smallint NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (bug_id,user_id)
);
CREATE TABLE TBL_BUG_DEPENDENCY (
bug_id smallint NOT NULL default '0',
depends_on smallint NOT NULL default '0',
PRIMARY KEY (bug_id,depends_on)
);
CREATE TABLE TBL_BUG_GROUP (
bug_id smallint NOT NULL default '0',
group_id smallint NOT NULL default '0',
PRIMARY KEY (bug_id,group_id),
);
CREATE TABLE TBL_BUG_HISTORY (
bug_id smallint NOT NULL default '0',
changed_field varchar(30) NOT NULL default '',
old_value varchar(255) NOT NULL default '',
new_value varchar(255) NOT NULL default '',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0'
);
CREATE TABLE TBL_BUG_VOTE (
user_id smallint NOT NULL default '0',
bug_id smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (user_id, bug_id),
);
CREATE TABLE TBL_COMMENT (
comment_id smallint NOT NULL default '0',
bug_id smallint NOT NULL default '0',
comment_text text NOT NULL,
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (comment_id)
);
CREATE TABLE TBL_COMPONENT (
component_id smallint NOT NULL default '0',
project_id smallint NOT NULL default '0',
component_name varchar(30) NOT NULL default '',
component_desc text NOT NULL,
owner smallint NOT NULL default '0',
active bit NOT NULL default '1',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (component_id)
);
CREATE TABLE TBL_CONFIGURATION (
varname char(40) NOT NULL default '',
varvalue char(255) NOT NULL default '',
description char(255) NOT NULL default '',
vartype char(20) NOT NULL default '',
PRIMARY KEY (varname)
);
CREATE TABLE TBL_GROUP_PERM (
group_id smallint NOT NULL default '0',
perm_id smallint NOT NULL default '0',
PRIMARY KEY (group_id,perm_id),
);
CREATE TABLE TBL_OS (
os_id smallint NOT NULL default '0',
os_name char(30) NOT NULL default '',
sort_order tinyint NOT NULL default '0',
regex char(40) NOT NULL default '',
PRIMARY KEY (os_id)
);
CREATE TABLE TBL_PROJECT (
project_id smallint NOT NULL default '0',
project_name varchar(30) NOT NULL default '',
project_desc text NOT NULL,
active bit NOT NULL default '1',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (project_id)
);
CREATE TABLE TBL_PROJECT_GROUP (
project_id smallint NOT NULL default '0',
group_id smallint NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (project_id,group_id),
);
CREATE TABLE TBL_PROJECT_PERM (
project_id smallint NOT NULL default '0',
user_id smallint NOT NULL default '0'
);
CREATE TABLE TBL_RESOLUTION (
resolution_id smallint NOT NULL default '0',
resolution_name varchar(30) NOT NULL default '',
resolution_desc text NOT NULL,
sort_order tinyint NOT NULL default '0',
PRIMARY KEY (resolution_id)
);
CREATE TABLE TBL_SAVED_QUERY (
saved_query_id smallint NOT NULL default '0',
user_id smallint NOT NULL default '0',
saved_query_name varchar(40) NOT NULL default '',
saved_query_string text NOT NULL,
PRIMARY KEY (saved_query_id,user_id)
);
CREATE TABLE TBL_SEVERITY (
severity_id smallint NOT NULL default '0',
severity_name varchar(30) NOT NULL default '',
severity_desc text NOT NULL,
sort_order tinyint NOT NULL default '0',
severity_color varchar(10) NOT NULL default '#FFFFFF',
PRIMARY KEY (severity_id)
);
CREATE TABLE TBL_STATUS (
status_id smallint NOT NULL default '0',
status_name varchar(30) NOT NULL default '',
status_desc text NOT NULL,
sort_order tinyint NOT NULL default '0',
bug_open bit NOT NULL default '1',
PRIMARY KEY (status_id)
);
CREATE TABLE TBL_USER_GROUP (
user_id smallint NOT NULL default '0',
group_id smallint NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (user_id,group_id),
);
CREATE TABLE TBL_USER_PERM (
user_id smallint NOT NULL default '0',
perm_id smallint NOT NULL default '0',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
PRIMARY KEY (user_id,perm_id),
);
CREATE TABLE TBL_USER_PREF (
user_id smallint NOT NULL default '0',
email_notices bit NOT NULL default '1',
saved_queries bit NOT NULL default '1',
def_results smallint NOT NULL default '20',
PRIMARY KEY (user_id)
);
CREATE TABLE TBL_VERSION (
version_id smallint NOT NULL default '0',
project_id smallint NOT NULL default '0',
version_name char(30) NOT NULL default '',
active bit NOT NULL default '1',
created_by smallint NOT NULL default '0',
created_date int NOT NULL default '0',
last_modified_by smallint NOT NULL default '0',
last_modified_date int NOT NULL default '0',
PRIMARY KEY (version_id)
);
CREATE TABLE TBL_DATABASE (
database_id tinyint NOT NULL default '0',
database_name varchar(40) NOT NULL default '',
sort_order tinyint NOT NULL default '0',
PRIMARY KEY (database_id)
);
CREATE TABLE TBL_SITE (
site_id tinyint NOT NULL default '0',
site_name varchar(50) NOT NULL default '',
sort_order tinyint NOT NULL default '0',
PRIMARY KEY (site_id)
);
#
# -- Insert initial data --
#
INSERT INTO TBL_AUTH_USER
(user_id, login, first_name, last_name, email, password)
values (1, 'OPTION_ADMIN_EMAIL', 'System', 'Admin', 'OPTION_ADMIN_EMAIL',
'OPTION_ADMIN_PASS');
CREATE TABLE TBL_AUTH_USER_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)
# Start off with three user levels...
INSERT INTO TBL_AUTH_GROUP (group_id, group_name, locked) VALUES (1, 'Admin', 1);
INSERT INTO TBL_AUTH_GROUP (group_id, group_name, locked) VALUES (2, 'User', 1);
INSERT INTO TBL_AUTH_GROUP (group_id, group_name, locked, assignable) VALUES (3, 'Developer', 1, 1);
CREATE TABLE TBL_AUTH_GROUP_seq ([id] [int] IDENTITY (3, 1) NOT NULL, [vapor] [int] NULL)
# ... and only two permissions
INSERT INTO TBL_AUTH_PERM (perm_id, perm_name) VALUES (1, 'Admin');
INSERT INTO TBL_AUTH_PERM (perm_id, perm_name) VALUES (2, 'Editbug');
INSERT INTO TBL_AUTH_PERM (perm_id, perm_name) VALUES (3, 'EditAssignment');
# Admins can do all the admin stuff and users can edit bugs
INSERT INTO TBL_GROUP_PERM (group_id, perm_id) VALUES (1, 1);
INSERT INTO TBL_GROUP_PERM (group_id, perm_id) VALUES (2, 2);
# And user_id 1 is an admin and a user
INSERT INTO TBL_USER_GROUP (user_id, group_id) VALUES (1, 1);
INSERT INTO TBL_USER_GROUP (user_id, group_id) VALUES (1, 2);
# Add user's prefs as default values for all users defined so far (only admin)
INSERT INTO TBL_USER_PREF (user_id) SELECT USER_ID FROM TBL_AUTH_USER;
INSERT INTO TBL_CONFIGURATION VALUES ('INSTALL_URL','OPTION_INSTALL_URL','The base URL of the phpBugTracker installation','string');
INSERT INTO TBL_CONFIGURATION VALUES ('JPGRAPH_PATH','','If not in the include path. This is the file path on the web server, not a URL.','string');
INSERT INTO TBL_CONFIGURATION VALUES ('CVS_WEB','http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpbt/phpbt/','Location of your cvs web interface (see format_comments() in bug.php)','string');
INSERT INTO TBL_CONFIGURATION VALUES ('ADMIN_EMAIL','OPTION_PHPBT_EMAIL','The email address used in correspondence from the bug tracker','string');
INSERT INTO TBL_CONFIGURATION VALUES ('ENCRYPT_PASS','OPTION_ENCRYPT_PASS','Whether to store passwords encrypted. Warning: Changing this after users have been created will result in their being unable to login.','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('USE_JPGRAPH','','Whether to show some reports as images','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('MASK_EMAIL','1','Should email addresses have . changed to ''dot'' and @ change to ''at''?','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('HIDE_EMAIL','1','Should email addresses be hidden for those not logged in?','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('USE_SEVERITY_COLOR','1','Should the query list use the severity colors as the row background color (like SourceForge)','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('EMAIL_IS_LOGIN','1','Whether to use email addresses as logins','bool');
INSERT INTO TBL_CONFIGURATION VALUES ('STRICT_UPDATING', '0', 'Only the bug reporter, bug owner, managers, and admins can change a bug', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('NEW_ACCOUNTS_DISABLED', '0', 'Only admins can create new user accounts - newaccount.php is disabled', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('RECALL_LOGIN', '0', 'Enable use of cookies to store username between logins', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('SHOW_PROJECT_SUMMARIES', '1', 'Itemize bug stats by project on the home page', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('FORCE_LOGIN', '0', 'Force users to login before being able to use the bug tracker', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('PROMOTE_VOTES', 5, 'The number of votes required to promote a bug from Unconfirmed to New (Set to 0 to disable promotions by voting)', 'string');
INSERT INTO TBL_CONFIGURATION VALUES ('MAX_USER_VOTES', 5, 'The maximum number of votes a user can cast across all bugs (Set to 0 to have no limit)', 'string');
INSERT INTO TBL_CONFIGURATION VALUES ('ATTACHMENT_PATH','attachments','Sub-dir of the INSTALLPATH - Needs to be writeable by the web process','string');
INSERT INTO TBL_CONFIGURATION VALUES ('THEME','default','Which set of templates to use','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('ATTACHMENT_MAX_SIZE','2097152','Maximum size (in bytes) of an attachment. This will not override the settings in php.ini if php.ini has a lower limit.','string');
INSERT INTO TBL_CONFIGURATION VALUES ('DATE_FORMAT','m-d-Y','See the date page in the PHP manual for more info','string');
INSERT INTO TBL_CONFIGURATION VALUES ('TIME_FORMAT','g:i A','See the date page in the PHP manual for more info','string');
INSERT INTO TBL_CONFIGURATION VALUES ('LANGUAGE','en','The language file to use for warning and error messages','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('STYLE', 'default', 'The CSS file to use (color scheme)', 'multi');
INSERT INTO TBL_CONFIGURATION VALUES ('SEND_MIME_EMAIL', '1', 'Whether to use MIME quoted-printable encoded emails or not', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('BUG_UNCONFIRMED','1','The status to assign a bug when it is first submitted.','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('BUG_PROMOTED','2','The status to assign a bug when it is promoted (if enabled).','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('BUG_ASSIGNED','3','The status to assign a bug when it is assigned.','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('BUG_REOPENED','4','The status to assign a bug when it is reopened.','multi');
INSERT INTO TBL_CONFIGURATION VALUES ('EMAIL_DISABLED', '0', 'Whether to disable all mail sent from the system', 'bool');
INSERT INTO TBL_OS VALUES (1,'All',1,'');
INSERT INTO TBL_OS VALUES (2,'Windows 3.1',2,'/Mozilla.*\\(Win16.*\\)/');
INSERT INTO TBL_OS VALUES (3,'Windows 95',3,'/Mozilla.*\\(.*;.*; 32bit.*\\)/');
INSERT INTO TBL_OS VALUES (4,'Windows 98',4,'/Mozilla.*\\(Win98.*\\)/');
INSERT INTO TBL_OS VALUES (5,'Windows ME',5,'');
INSERT INTO TBL_OS VALUES (6,'Windows 2000',6,'/Mozilla.*Windows NT 5.*\\)/');
INSERT INTO TBL_OS VALUES (7,'Windows NT',7,'/Mozilla.*\\(Windows.*NT/');
INSERT INTO TBL_OS VALUES (8,'Mac System 7',8,'');
INSERT INTO TBL_OS VALUES (9,'Mac System 7.5',9,'');
INSERT INTO TBL_OS VALUES (10,'Mac System 7.6.1',10,'');
INSERT INTO TBL_OS VALUES (11,'Mac System 8.0',11,'');
INSERT INTO TBL_OS VALUES (12,'Mac System 8.5',12,'/Mozilla.*\\(.*;.*; 68K.*\\)/');
INSERT INTO TBL_OS VALUES (13,'Mac System 8.6',13,'/Mozilla.*\\(.*;.*; PPC.*\\)/');
INSERT INTO TBL_OS VALUES (14,'Mac System 9.0',14,'');
INSERT INTO TBL_OS VALUES (15,'Mac OS X',15,'');
INSERT INTO TBL_OS VALUES (16,'Linux',16,'/Mozilla.*\\(.*;.*; Linux.*\\)/');
INSERT INTO TBL_OS VALUES (17,'BSDI',17,'/Mozilla.*\\(.*;.*; BSD\\/OS.*\\)/');
INSERT INTO TBL_OS VALUES (18,'FreeBSD',18,'/Mozilla.*\\(.*;.*; FreeBSD.*\\)/');
INSERT INTO TBL_OS VALUES (19,'NetBSD',19,'');
INSERT INTO TBL_OS VALUES (20,'OpenBSD',20,'');
INSERT INTO TBL_OS VALUES (21,'AIX',21,'/Mozilla.*\\(.*;.*; AIX.*\\)/');
INSERT INTO TBL_OS VALUES (22,'BeOS',22,'');
INSERT INTO TBL_OS VALUES (23,'HP-UX',23,'/Mozilla.*\\(.*;.*; HP-UX.*\\)/');
INSERT INTO TBL_OS VALUES (24,'IRIX',24,'/Mozilla.*\\(.*;.*; IRIX.*\\)/');
INSERT INTO TBL_OS VALUES (25,'Neutrino',25,'');
INSERT INTO TBL_OS VALUES (26,'OpenVMS',26,'');
INSERT INTO TBL_OS VALUES (27,'OS/2',27,'');
INSERT INTO TBL_OS VALUES (28,'OSF/1',28,'/Mozilla.*\\(.*;.*; OSF.*\\)/');
INSERT INTO TBL_OS VALUES (29,'Solaris',29,'/Mozilla.*\\(.*;.*; SunOS 5.*\\)/');
INSERT INTO TBL_OS VALUES (30,'SunOS',30,'/Mozilla.*\\(.*;.*; SunOS.*\\)/');
INSERT INTO TBL_OS VALUES (31,'other',31,'');
CREATE TABLE TBL_OS_seq ([id] [int] IDENTITY (31, 1) NOT NULL, [vapor] [int] NULL)
INSERT INTO TBL_RESOLUTION VALUES (1,'Fixed','Bug was eliminated',1);
INSERT INTO TBL_RESOLUTION VALUES (2,'Not a bug','It''s not a bug -- it''s a feature!',2);
INSERT INTO TBL_RESOLUTION VALUES (3,'Won''t Fix','This bug will stay',3);
INSERT INTO TBL_RESOLUTION VALUES (4,'Deferred','We''ll get around to it later',4);
INSERT INTO TBL_RESOLUTION VALUES (5,'Works for me','Can''t replicate the bug',5);
INSERT INTO TBL_RESOLUTION VALUES (6,'Duplicate','',6);
CREATE TABLE TBL_RESOLUTION_seq ([id] [int] IDENTITY (6, 1) NOT NULL, [vapor] [int] NULL)
INSERT INTO TBL_SEVERITY VALUES (1,'Unassigned','Default bug creation',1,'#dadada');
INSERT INTO TBL_SEVERITY VALUES (2,'Idea','Ideas for further development',2,'#dad0d0');
INSERT INTO TBL_SEVERITY VALUES (3,'Feature Request','Requests for specific features',3,'#dacaca');
INSERT INTO TBL_SEVERITY VALUES (4,'Annoyance','Cosmetic problems or bugs not affecting performance',4,'#dac0c0');
INSERT INTO TBL_SEVERITY VALUES (5,'Content','Non-functional related bugs, such as text content',5,'#dababa');
INSERT INTO TBL_SEVERITY VALUES (6,'Significant','A bug affecting the intended performance of the product',6,'#dab0b0');
INSERT INTO TBL_SEVERITY VALUES (7,'Critical','A bug severe enough to prevent the release of the product',7,'#daaaaa');
CREATE TABLE TBL_SEVERITY_seq ([id] [int] IDENTITY (7, 1) NOT NULL, [vapor] [int] NULL)
INSERT INTO TBL_STATUS VALUES (1,'Unconfirmed','Reported but not confirmed',1, 1);
INSERT INTO TBL_STATUS VALUES (2,'New','A new bug',2,1);
INSERT INTO TBL_STATUS VALUES (3,'Assigned','Assigned to a developer',3,1);
INSERT INTO TBL_STATUS VALUES (4,'Reopened','Closed but opened again for further inspection',4,1);
INSERT INTO TBL_STATUS VALUES (5,'Resolved','Set by engineer with a resolution',5,0);
INSERT INTO TBL_STATUS VALUES (6,'Verified','The resolution is confirmed by the reporter',6,0);
INSERT INTO TBL_STATUS VALUES (7,'Closed','The bug is officially squashed (QA)',7,0);
CREATE TABLE TBL_STATUS_seq ([id] [int] IDENTITY (7, 1) NOT NULL, [vapor] [int] NULL)
INSERT INTO TBL_DATABASE VALUES (1,'Oracle 8.1.7',1);
INSERT INTO TBL_DATABASE VALUES (2,'MySQL 3.23.49',2);
INSERT INTO TBL_DATABASE VALUES (3,'PostgreSQL 7.1.3',3);
CREATE TABLE TBL_DATABASE_seq ([id] [int] IDENTITY (3, 1) NOT NULL, [vapor] [int] NULL)
# Examples only
INSERT INTO TBL_SITE VALUES (0,'All',1);
INSERT INTO TBL_SITE VALUES (1,'Production - location 1',2);
INSERT INTO TBL_SITE VALUES (2,'Production - location 2',3);
INSERT INTO TBL_SITE VALUES (3,'Test site - location 1',4);
INSERT INTO TBL_SITE VALUES (4,'Test site - location 2',5);
CREATE TABLE TBL_SITE_seq ([id] [int] IDENTITY (4, 1) NOT NULL, [vapor] [int] NULL)
#-- Sequences for the tables with no initial entries
CREATE TABLE TBL_BUG_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)
CREATE TABLE TBL_COMMENT_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)
CREATE TABLE TBL_COMPONENT_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)
CREATE TABLE TBL_PROJECT_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)
CREATE TABLE TBL_VERSION_seq ([id] [int] IDENTITY (1, 1) NOT NULL, [vapor] [int] NULL)