/*==============================================================*/
/* Table: SYSPARAMETERS                                         */
/*==============================================================*/
update SYSPARAMETERS set VALUESTRING = '37' where CONTEXT = 'SYSTEMINFO' and name = 'DBVersionLow';
update SYSPARAMETERS set VALUESTRING = '2004-02-21' where CONTEXT = 'SYSTEMINFO' and name = 'DBCreationDate';
     
delete from SYSPARAMETERS where SYSPARAMETERID = 38;   
delete from SYSPARAMETERS where SYSPARAMETERID = 39;
delete from SYSPARAMETERS where SYSPARAMETERID = 40;     
delete from SYSPARAMETERS where SYSPARAMETERID = 41;
delete from SYSPARAMETERS where SYSPARAMETERID = 42;

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (38, 'ARCHIVE', 'CleaningPeriod', 7, 'Cleaning period of the data archive in days', 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (39, 'ARCHIVE', 'MinimumAge', 30, 'Minimum Age of files can be deleted in minutes', 0, 0, 0, 1);
     
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (40, 'ARCHIVE', 'StartBackupHour', 0, 'Scheduling hour for backup (start)', 0, 0, 0, 1);
     
insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (41, 'ARCHIVE', 'EndBackupHour', 3, 'Scheduling hour for backup (end)', 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (42, 'ARCHIVECATEGORY', 'EnableArchiveCategory', '0', 'Enable archive (zipping) of a category', 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (43, 'ARCHIVECATEGORY', 'ArchiveCategoryPath', '/tmp', 'Enable archive (zipping) of a category', 0, 0, 0, 0);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (44, 'DOCUMENT', 'EnableDocumentStatusCoverage', '0', 'Enable input of document status', 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (45, 'DOCUMENT', 'EnableDocumentClassCoverage', '0', 'Enable input of document class', 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (46, 'PROJECTMANAGEMENT', 'EnableProjectManagement', '0', 'Enable project management', 0, 0, 0, 2);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (47, 'PROJECTMANAGEMENT', 'ProjectRootCategoryId', '0', 'ID of the root category for projectmanagement', 0, 0, 0, 1);

insert into SYSPARAMETERS
            (SYSPARAMETERID, CONTEXT, NAME, VALUESTRING, DESCRIPTION, ALLOWNULL, READONLY, HIDE, DATATYPE)
     values (48, 'PROJECTMANAGEMENT', 'TemplateCategoryId', '0', 'ID of the template category', 0, 0, 0, 1);


/* categorie status */
alter table categories
  add status integer;

/* categorie status */
alter table news
  add headline varchar(255) not null;

/* category stati */
/*==============================================================*/
/* Table: CATEGORYSTATI                                         */
/*==============================================================*/
create table CATEGORYSTATI (
STATUS               INTEGER                        not null,
DESCRIPTION          VARCHAR(50)                    not null,
DESC_KEY             VARCHAR(50),
REMARK               VARCHAR(50),
constraint PK_CATEGORYSTATI primary key (STATUS)
);


alter table CATEGORIES
   add constraint FK_CATEGORYSTATI foreign key (STATUS)
      references CATEGORYSTATI (STATUS);



/* catprojectsteps */
/*==============================================================*/
/* Table: CATPROJECTSTEPS                                       */
/*==============================================================*/
create table CATPROJECTSTEPS (
CATPROJSTEPID        INTEGER                        not null,
CATEGORYID           INTEGER                        not null,
STEP                 INTEGER                        not null,
ACTIVITY             VARCHAR(255)                   not null,
DEADLINE             TIMESTAMP                      not null,
PROCESSED            INTEGER                        not null,
PROCESSORID          INTEGER,
PROCESSEDTS          TIMESTAMP,
ENABLED              INTEGER                        not null,
ENABLEDTS            TIMESTAMP,
ENABLERID            INTEGER,
constraint PK_CATPROJECTSTEPS primary key (CATPROJSTEPID)
);


/*==============================================================*/
/* Index: INDEX_28                                              */
/*==============================================================*/
create unique asc index INDEX_28 on CATPROJECTSTEPS (
CATEGORYID,
STEP
);

/*==============================================================*/
/* Index: GENERATORS                                            */
/*==============================================================*/
create generator ACLIDS_SEQ;
create generator ACLTYPES_SEQ;
create generator ADDCATATTRS_SEQ;
create generator ADDDOCATTRS_SEQ;
create generator ADDGROUPATTRS_SEQ;
create generator ADDUSERATTRS_SEQ;
create generator ADDITIONALDOCUMENTFORMATS_SEQ;
create generator CATEGORIES_SEQ;
create generator CATPROJECTSTEPS_SEQ;
create generator DEFAULTCATACLS_SEQ;
create generator CONVERTERTIMING_SEQ;
create generator CONVERSIONSTATI_SEQ;
create generator CONVERTER_SEQ;
create generator VKCSERVER_SEQ;
create generator CATEGORYACLS_SEQ;
create generator CATEGORYDOCUMENTS_SEQ;
create generator CATEGORYLINKS_SEQ;
create generator CATEGORYDOCUMENTLINKS_SEQ;
create generator DOCUMENTS_SEQ;
create generator DEFAULTDOCACLS_SEQ;
create generator DOCUMENTACLS_SEQ;
create generator DOCUMENTCLASSES_SEQ;
create generator DOCUMENTTYPES_SEQ;
create generator DYNATTRIBUTES_SEQ;
create generator LANGUAGEPACKS_SEQ;
create generator LANGUAGES_SEQ;
create generator MSGTIMEPERIODS_SEQ;
create generator NEWS_SEQ;
create generator PERMISSIONS_SEQ;
create generator SYSPARAMETERS_SEQ;
create generator TEMPLATES_SEQ;
create generator USERDOCMAILS_SEQ;
create generator GROUPS_SEQ;
create generator USERS_SEQ;
create generator PROXYUSERS_SEQ;

alter table CATEGORIES add CATEGORYTYPE INTEGER;
update CATEGORIES set CATEGORYTYPE = 0;
commit;

