head	1.2;
access;
symbols
	TIGRIS_1_1_0RC2:1.2
	TIGRIS_1_1_0RC1:1.2
	TIGRIS_1_1:1.2.0.4
	TIGRIS_1_0_8:1.2
	TIGRIS_1_0_8RC3:1.2
	TIGRIS_1_0_8RC2:1.2
	TIGRIS_1_0_8RC1:1.2
	TIGRIS_1_0_7:1.2
	TIGRIS_1_0_7RC3:1.2
	TIGRIS_1_0_7RC2:1.2
	TIGRIS_1_0_7RC1:1.2
	TIGRIS_1_0_6:1.2
	TIGRIS_1_0_6RC5:1.2
	TIGRIS_1_0_6RC4:1.2
	TIGRIS_1_0_6RC3:1.2
	TIGRIS_1_0_6RC2:1.2
	TIGRIS_1_0_6RC1:1.2
	TIGRIS_1_0_5:1.2
	TIGRIS_1_0_5RC6:1.2
	TIGRIS_1_0_5RC5:1.2
	TIGRIS_1_0_5RC4:1.2
	TIGRIS_1_0_5RC3:1.2
	TIGRIS_1_0_5RC2:1.2
	TIGRIS_1_0_5RC1:1.2
	TIGRIS_1_0_4:1.2
	TIGRIS_1_0_3:1.2
	TIGRIS_1_0_2:1.2
	TIGRIS_1_0_1:1.2
	TIGRIS_1_0:1.2.0.6
	TIGRIS_1_0_0:1.2
	TIGRIS_1_0_0_RC1:1.2.0.2;
locks; strict;
comment	@# @;


1.2
date	2001.03.22.21.16.20;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.03.17.07.50.48;	author leonardr;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Added additional indices now added by Torque for multipart primary keys.
@
text
@#Tables which we drop later, after sucking information from them:
#UserRole
#Role
#domain_projects
#project_privs
#project_mlists
#domain_config (?)

# Table renames
# =============

alter table User
    rename as HELM_USER,
    drop primary key,
    drop index loginID,
    change column userID USER_ID int(11) DEFAULT '0' NOT NULL auto_increment,
    add column DOMAIN_ID int(11) DEFAULT '0' NOT NULL,
    change column loginID LOGIN_NAME varchar(32) DEFAULT '' NOT NULL,
    change column password PASSWORD varchar(32),
    change column name REAL_NAME varchar(99) DEFAULT '' NOT NULL,
    change column address1 ADDRESS1 varchar(32),
    change column address2 ADDRESS2 varchar(32),
    change column city CITY varchar(32),
    change column state STATE varchar(32),
    change column postalCode POSTALCODE varchar(32),
    change column country COUNTRY varchar(32),
    change column citizenship CITIZENSHIP varchar(32),
    change column phone PHONE varchar(32),
    change column altPhone ALTPHONE varchar(32),
    change column fax FAX varchar(32),
    change column cell CELL varchar(32),
    change column pager PAGER varchar(32),
    change column email EMAIL varchar(99),
    add column ORGANIZATION varchar(99) DEFAULT '',
    change column modified MODIFIED timestamp(14),
    change column created CREATED timestamp(14),
    add column TYPE varchar(6) DEFAULT 'base' NOT NULL,
    add column PASSWORD_TICKET varchar(255),
    add primary key (USER_ID),
    add unique LOGIN_NAME (LOGIN_NAME,DOMAIN_ID),
    add index TYPE (TYPE);

# Deleted Tables
# ==============
drop table if exists DeletedUser;
drop table if exists Permission;
drop table if exists PermissionExtent;
drop table if exists RolePermission;
drop table if exists domain_users;
drop table if exists domain_privs;
drop table if exists module_privs;
drop table if exists module_website;
drop table if exists project_modules;

#bugzilla
drop table if exists attachments;
drop table if exists bugs;
drop table if exists bugs_activity;
drop table if exists cc;
drop table if exists components;
drop table if exists dependencies;
drop table if exists groups;
drop table if exists logincookies;
drop table if exists products;
drop table if exists profiles;
drop table if exists versions;

#new tables

--------------------------------------------------------------------------
-- HELM_ACTION
--------------------------------------------------------------------------
drop table if exists HELM_ACTION;

CREATE TABLE HELM_ACTION
(
    ACTION_ID INTEGER NOT NULL AUTO_INCREMENT,
    NAME VARCHAR (99) NOT NULL,
    TYPE VARCHAR (7) default 'Host',
    TAKES_RESOURCE VARCHAR (1) default 'N' NOT NULL,
    AFFECTED_BY_PROJECT_LOCK VARCHAR (1) default 'N' NOT NULL,
    PRIMARY KEY(ACTION_ID),
    UNIQUE (NAME)
  
);

--------------------------------------------------------------------------
-- HELM_AUDIT_LOG_ENTRY
--------------------------------------------------------------------------
drop table if exists HELM_AUDIT_LOG_ENTRY;

CREATE TABLE HELM_AUDIT_LOG_ENTRY
(
    ENTRY_ID INTEGER NOT NULL AUTO_INCREMENT,
    TIMESTAMP TIMESTAMP,
    AFFECTED_TYPE VARCHAR (7) default 'Host' NOT NULL,
    AFFECTED_ID INTEGER NOT NULL,
    INITIATING_USER INTEGER NOT NULL,
    DESCRIPTION LONGTEXT,
    RATIONALE LONGTEXT,
    PRIMARY KEY(ENTRY_ID),
    FOREIGN KEY (INITIATING_USER) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_DOMAIN
--------------------------------------------------------------------------
drop table if exists HELM_DOMAIN;

CREATE TABLE HELM_DOMAIN
(
    DOMAIN_ID INTEGER NOT NULL AUTO_INCREMENT,
    NAME VARCHAR (255) NOT NULL,
    PRIMARY KEY(DOMAIN_ID),
    UNIQUE (NAME)
  
);

--------------------------------------------------------------------------
-- HELM_INVITATION
--------------------------------------------------------------------------
drop table if exists HELM_INVITATION;

CREATE TABLE HELM_INVITATION
(
    INVITATION_ID INTEGER NOT NULL AUTO_INCREMENT,
    TICKET VARCHAR (255) NOT NULL,
    PROJECT_ID INTEGER NOT NULL,
    INVITATION_DATE TIMESTAMP NOT NULL,
    PRIMARY KEY(INVITATION_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECTDOCUMENT
--------------------------------------------------------------------------
drop table if exists HELM_PROJECTDOCUMENT;

CREATE TABLE HELM_PROJECTDOCUMENT
(
    DOCUMENT_ID INTEGER NOT NULL AUTO_INCREMENT,
    PROJECT_ID INTEGER NOT NULL,
    NAME VARCHAR (128) NOT NULL,
    DESCRIPTION LONGTEXT default '',
    TYPE VARCHAR (128) NOT NULL,
    FILE_NAME VARCHAR (128),
    IS_PUBLIC VARCHAR (1) default 'N' NOT NULL,
    MD5 VARCHAR (255),
    SIZE BIGINT NOT NULL,
    UPLOADED_DATE DATE,
    LOCATION VARCHAR (128),
    URL VARCHAR (128),
    TEXT VARCHAR (255),
    PROPOSED_BY INTEGER NOT NULL,
    APPROVED_BY INTEGER,
    PRIMARY KEY(DOCUMENT_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (PROPOSED_BY) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECT_DOCUMENT_SECTION
--------------------------------------------------------------------------
drop table if exists HELM_PROJECT_DOCUMENT_SECTION;

CREATE TABLE HELM_PROJECT_DOCUMENT_SECTION
(
    DOCUMENT_ID INTEGER NOT NULL,
    SECTION_ID INTEGER NOT NULL,
    PRIMARY KEY(DOCUMENT_ID,SECTION_ID),
    INDEX(SECTION_ID),
    FOREIGN KEY (DOCUMENT_ID) REFERENCES HELM_PROJECTDOCUMENT (DOCUMENT_ID),
    FOREIGN KEY (SECTION_ID) REFERENCES HELM_PROJECTSECTION (SECTION_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECTDOWNLOAD
--------------------------------------------------------------------------
drop table if exists HELM_PROJECTDOWNLOAD;

CREATE TABLE HELM_PROJECTDOWNLOAD
(
    DOWNLOAD_ID INTEGER NOT NULL AUTO_INCREMENT,
    PROJECT_ID INTEGER NOT NULL,
    FILE_NAME VARCHAR (128) NOT NULL,
    LOCATION VARCHAR (128) NOT NULL,
    PROPOSED_BY INTEGER NOT NULL,
    APPROVED_BY INTEGER,
    IS_PUBLIC VARCHAR (1) default 'N' NOT NULL,
    DESCRIPTION LONGTEXT default '',
    UPLOADED_DATE DATE NOT NULL,
    SIZE BIGINT NOT NULL,
    MD5 VARCHAR (255),
    PRIMARY KEY(DOWNLOAD_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (PROPOSED_BY) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECT_PROJECTGROUP
--------------------------------------------------------------------------
drop table if exists HELM_PROJECT_PROJECTGROUP;

CREATE TABLE HELM_PROJECT_PROJECTGROUP
(
    PROJECT_ID INTEGER NOT NULL,
    PROJECT_GROUP_ID INTEGER NOT NULL,
    PRIMARY KEY(PROJECT_ID,PROJECT_GROUP_ID),
    INDEX(PROJECT_GROUP_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (PROJECT_GROUP_ID) REFERENCES HELM_PROJECT (PROJECT_ID)
);

--------------------------------------------------------------------------
-- HELM_NEWSITEM
--------------------------------------------------------------------------
drop table if exists HELM_NEWSITEM;

CREATE TABLE HELM_NEWSITEM
(
    NEWS_ID INTEGER NOT NULL AUTO_INCREMENT,
    PROJECT_ID INTEGER NOT NULL,
    EVENT_DATE DATE,
    HEADLINE VARCHAR (128) NOT NULL,
    BODY LONGTEXT NOT NULL,
    PROPOSED_BY INTEGER NOT NULL,
    APPROVED_BY INTEGER NOT NULL,
    PUBLISH_DATE DATE,
    REMOVE_DATE DATE,
    PRIORITY INTEGER,
    PRIMARY KEY(NEWS_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (PROPOSED_BY) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_MAILINGLIST
--------------------------------------------------------------------------
drop table if exists HELM_MAILINGLIST;

CREATE TABLE HELM_MAILINGLIST
(
    MAILINGLIST_ID INTEGER NOT NULL AUTO_INCREMENT,
    PROJECT_ID INTEGER NOT NULL,
    LIST_NAME VARCHAR (64) NOT NULL,
    TYPE VARCHAR (64) NOT NULL,
    IS_PRIVATE VARCHAR (1) default 'N' NOT NULL,
    DESCRIPTION LONGTEXT,
    PRIMARY KEY(MAILINGLIST_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECT
--------------------------------------------------------------------------
drop table if exists HELM_PROJECT;

CREATE TABLE HELM_PROJECT
(
    PROJECT_ID INTEGER NOT NULL AUTO_INCREMENT,
    DOMAIN_ID INTEGER NOT NULL,
    NAME VARCHAR (64) default '' NOT NULL,
    LICENSE VARCHAR (64),
    SHORT_DESCRIPTION VARCHAR (64),
    LONG_DESCRIPTION LONGTEXT,
    USE_INDEX VARCHAR (1) default 'N' NOT NULL,
    STATUS LONGTEXT default '',
    PROFILE VARCHAR (11) default 'development' NOT NULL,
    TYPE VARCHAR (8) default 'base' NOT NULL,
    ALIAS_URL VARCHAR (128),
    MEMBER_POLICY INTEGER NOT NULL,
    PROPOSED_BY INTEGER NOT NULL,
    APPROVED_BY INTEGER NOT NULL,
    IS_PROPRIETARY VARCHAR (1) default 'N' NOT NULL,
    LOCKED VARCHAR (1) default 'N' NOT NULL,
    PRIMARY KEY(PROJECT_ID),
    FOREIGN KEY (DOMAIN_ID) REFERENCES HELM_DOMAIN (DOMAIN_ID),
    FOREIGN KEY (PROPOSED_BY) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_PROJECTSECTION
--------------------------------------------------------------------------
drop table if exists HELM_PROJECTSECTION;

CREATE TABLE HELM_PROJECTSECTION
(
    SECTION_ID INTEGER NOT NULL AUTO_INCREMENT,
    PARENT_ID INTEGER default NULL,
    PROJECT_ID INTEGER NOT NULL,
    NAME VARCHAR (128) NOT NULL,
    DESCRIPTION VARCHAR (255) default '',
    PROPOSED_BY INTEGER NOT NULL,
    APPROVED_BY INTEGER,
    PRIMARY KEY(SECTION_ID),
    FOREIGN KEY (PARENT_ID) REFERENCES HELM_PROJECTSECTION (SECTION_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (PROPOSED_BY) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_RESOURCE
--------------------------------------------------------------------------
drop table if exists HELM_RESOURCE;

CREATE TABLE HELM_RESOURCE
(
    RESOURCE_ID INTEGER NOT NULL AUTO_INCREMENT,
    PATTERN VARCHAR (99) NOT NULL,
    DESCRIPTION VARCHAR (99) NOT NULL,
    PRIMARY KEY(RESOURCE_ID),
    UNIQUE (PATTERN)
  
);

--------------------------------------------------------------------------
-- HELM_ROLE
--------------------------------------------------------------------------
drop table if exists HELM_ROLE;

CREATE TABLE HELM_ROLE
(
    ROLE_ID INTEGER NOT NULL AUTO_INCREMENT,
    NAME VARCHAR (99) NOT NULL,
    TYPE VARCHAR (7) default 'Project' NOT NULL,
    DESCRIPTION LONGTEXT,
    DENOTES_OWNER VARCHAR (1) default 'N' NOT NULL,
    REQUESTABLE VARCHAR (1) default 'N' NOT NULL,
    PRIMARY KEY(ROLE_ID),
    UNIQUE (NAME)
  
);

--------------------------------------------------------------------------
-- HELM_ROLE_ACTION_RESOURCE
--------------------------------------------------------------------------
drop table if exists HELM_ROLE_ACTION_RESOURCE;

CREATE TABLE HELM_ROLE_ACTION_RESOURCE
(
    ROLE_ID INTEGER NOT NULL,
    ACTION_ID INTEGER NOT NULL,
    RESOURCE_ID INTEGER NOT NULL,
    PRIMARY KEY(ROLE_ID,ACTION_ID,RESOURCE_ID),
    INDEX(ACTION_ID,RESOURCE_ID),
    INDEX(RESOURCE_ID),
    FOREIGN KEY (ROLE_ID) REFERENCES HELM_ROLE (ROLE_ID),
    FOREIGN KEY (ACTION_ID) REFERENCES HELM_ACTION (ACTION_ID),
    FOREIGN KEY (RESOURCE_ID) REFERENCES HELM_RESOURCE (RESOURCE_ID)
);

--------------------------------------------------------------------------
-- HELM_TASK
--------------------------------------------------------------------------
drop table if exists HELM_TASK;

CREATE TABLE HELM_TASK
(
    TASK_ID INTEGER NOT NULL AUTO_INCREMENT,
    TIMESTAMP TIMESTAMP,
    ON_BEHALF_OF INTEGER NOT NULL,
    COMPONENT VARCHAR (255),
    AFFECTED_OBJECT_ID INTEGER,
    COMMAND LONGTEXT,
    ARGUMENTS LONGTEXT,
    PRIMARY KEY(TASK_ID),
    FOREIGN KEY (ON_BEHALF_OF) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_USER_USERGROUP
--------------------------------------------------------------------------
drop table if exists HELM_USER_USERGROUP;

CREATE TABLE HELM_USER_USERGROUP
(
    USER_ID INTEGER NOT NULL,
    USER_GROUP_ID INTEGER NOT NULL,
    PRIMARY KEY(USER_ID,USER_GROUP_ID),
    INDEX(USER_GROUP_ID),
    FOREIGN KEY (USER_ID) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (USER_GROUP_ID) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_USER_PROJECT_INTEREST
--------------------------------------------------------------------------
drop table if exists HELM_USER_PROJECT_INTEREST;

CREATE TABLE HELM_USER_PROJECT_INTEREST
(
    USER_ID INTEGER NOT NULL,
    PROJECT_ID INTEGER NOT NULL,
    PRIMARY KEY(USER_ID,PROJECT_ID),
    INDEX(PROJECT_ID),
    FOREIGN KEY (USER_ID) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID)
);

--------------------------------------------------------------------------
-- HELM_USER_ROLE_PROJECT
--------------------------------------------------------------------------
drop table if exists HELM_USER_ROLE_PROJECT;

CREATE TABLE HELM_USER_ROLE_PROJECT
(
    USER_ID INTEGER NOT NULL,
    ROLE_ID INTEGER NOT NULL,
    PROJECT_ID INTEGER NOT NULL,
    APPROVED_BY INTEGER,
    PRIMARY KEY(USER_ID,ROLE_ID,PROJECT_ID),
    INDEX(ROLE_ID,PROJECT_ID),
    INDEX(PROJECT_ID),
    FOREIGN KEY (USER_ID) REFERENCES HELM_USER (USER_ID),
    FOREIGN KEY (ROLE_ID) REFERENCES HELM_ROLE (ROLE_ID),
    FOREIGN KEY (PROJECT_ID) REFERENCES HELM_PROJECT (PROJECT_ID),
    FOREIGN KEY (APPROVED_BY) REFERENCES HELM_USER (USER_ID)
);

--------------------------------------------------------------------------
-- HELM_VC_MAP
--------------------------------------------------------------------------
drop table if exists HELM_VC_MAP;

CREATE TABLE HELM_VC_MAP
(
    MAP_ID INTEGER NOT NULL AUTO_INCREMENT,
    VIEW_ID INTEGER NOT NULL,
    REPOSITORY_DIR LONGTEXT NOT NULL,
    WORKING_DIR LONGTEXT,
    FILE_LIST LONGTEXT,
    PRIMARY KEY(MAP_ID),
    FOREIGN KEY (VIEW_ID) REFERENCES HELM_VC_VIEW (VIEW_ID)
);

--------------------------------------------------------------------------
-- HELM_VC_VIEW
--------------------------------------------------------------------------
drop table if exists HELM_VC_VIEW;

CREATE TABLE HELM_VC_VIEW
(
    VIEW_ID INTEGER NOT NULL AUTO_INCREMENT,
    DOMAIN_ID INTEGER NOT NULL,
    NAME LONGTEXT NOT NULL,
    PRIMARY KEY(VIEW_ID),
    FOREIGN KEY (DOMAIN_ID) REFERENCES HELM_DOMAIN (DOMAIN_ID)
);
@


1.1
log
@Added scripts to convert from Tigris Classic (tm) to Tigris 1.0.0 (tm). Lovely. A few TODOs: 1) Convert project_mlists into Anzu options. 2) Figure out what to do with the domain_config table. 3) Put in the Eyebrowse tables. 4) Plug in the Bugzilla -> Issuezilla conversion script (yet to be written). That's all for today, I'm going home.
@
text
@d172 1
d211 1
d350 2
d385 1
d400 1
d417 2
@

