CREATE TABLE APP_ACT_COE_PAL_UPFILE(ID  CHAR(36) NOT NULL ,PALREPOSITORYID  CHAR(36),SHAPEID  VARCHAR(64),FILETYPE  CHAR(1),FILENAME  VARCHAR(128),DOWNLOAD  SMALLINT ,CREATEUSER  VARCHAR(36),CREATETIME   DATETIME YEAR TO SECOND , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_FILE(ID  VARCHAR(64) NOT NULL ,PALREPOSITORYID  CHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SYSTEMNAME(ID  CHAR(36) NOT NULL ,SYSTEMNAME  VARCHAR(36),ISDEFAULT  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_TEAM_PERM(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),WSID  CHAR(36),PERMTYPE  SMALLINT ,RESOURCEID  VARCHAR(128), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_TEAMMBR_PERM(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),USERID  VARCHAR(36),ACTIONTYPE  VARCHAR(64),EXTENDAPPS  VARCHAR(225), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),GROUPCODE  VARCHAR(36),CATEGORY  VARCHAR(64),GROUPNAME  VARCHAR(128),GROUPDESC  LVARCHAR(510),CREATEUSER  VARCHAR(36),CREATEDATE   DATETIME YEAR TO SECOND , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP_PERM(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),PERMTYPE  SMALLINT ,RESOURCEID  VARCHAR(128), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP_ROLE(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),ROLEID  VARCHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_COMMENT(ID  CHAR(36) NOT NULL ,PID  CHAR(36),STREAMID  CHAR(36),WSID  CHAR(36),TARGETTYPE  SMALLINT ,TARGETID  CHAR(36),TEAMID  CHAR(36),USERID  VARCHAR(36),USERCOMMENT  LVARCHAR(2000),COMMENTDATE   DATETIME YEAR TO SECOND ,INFOTYPE  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH(ID  CHAR(36) NOT NULL ,PROCESSINSTID  VARCHAR(36),WSID  CHAR(36),USERID  VARCHAR(36),AUDITORID  VARCHAR(36),PUBLISHDATE   DATETIME YEAR TO SECOND ,PUBLISHDESC  LVARCHAR(2000),PUBLISHN  DECIMAL(6,0),PUBLISHC  DECIMAL(6,0),PUBLISHS  DECIMAL(6,0),TEAMID  CHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH_LIST(ID  CHAR(36) NOT NULL ,PID  CHAR(36),PALREPOSITORYID  CHAR(36),ACTIONTYPE  CHAR(1),PUBLISHDESC  LVARCHAR(510),TASKID  CHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_OUTPUT_TASK(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),WSID  CHAR(36),PROFILEID  VARCHAR(36),TASKNAME  VARCHAR(64),USERID  VARCHAR(36),CREATETIME   DATETIME YEAR TO SECOND ,BEGINTIME   DATETIME YEAR TO SECOND ,ENDTIME   DATETIME YEAR TO SECOND ,TASKSTATE  SMALLINT ,THREADID  VARCHAR(128),LANG  VARCHAR(32),ISDISPLAY  VARCHAR(2), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PROP(PROPERTYKEY  VARCHAR(128) NOT NULL ,PROPERTYVALUE  LVARCHAR(4000) , PRIMARY KEY (PROPERTYKEY)) ;

CREATE TABLE APP_ACT_COE_USER(ID  CHAR(36) NOT NULL ,USERID  VARCHAR(36),ISADMIN  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_WORKSPACE(ID  CHAR(36) NOT NULL ,WSNAME  LVARCHAR(510),WSDM  LVARCHAR(510),WSADMIN  LVARCHAR(510),WSDESC  LVARCHAR(510),WSSTATE  SMALLINT ,WSORGTYPE  SMALLINT ,WSTCTYPE  SMALLINT ,WSBGURL  LVARCHAR(510),WSORDERINDEX  SMALLINT ,WSVER  SMALLINT ,WSVERSIONUUID  CHAR(36),ISUSE  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_REPOSITORY(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLRID  CHAR(36),PLNO  VARCHAR(36),PLNAME  VARCHAR(128),PLLEVEL  SMALLINT ,PLPARENTID  VARCHAR(36),PLORDERINDEX  SMALLINT ,PLISBOTTOMLEVEL  SMALLINT ,PLDESC  LVARCHAR(4000),PLRD  VARCHAR(36),PLRP  VARCHAR(36),PM  VARCHAR(36),PLINPUT  LVARCHAR(510),PLOUTPUT  LVARCHAR(510),PLEXECTYPE  SMALLINT ,PLSYSTEMNAME  VARCHAR(36),PLAWSPID  CHAR(36),PLDIAGRAMURL  LVARCHAR(510),PLCOLOR  VARCHAR(36),PLCATEGORY  VARCHAR(36),PLMETHODID  VARCHAR(36),PLVER  SMALLINT ,PLVERSIONID  CHAR(36),ISUSE  SMALLINT ,ISPUBLISH  SMALLINT ,ISSYSTEMFILE  SMALLINT ,FILEPATH  LVARCHAR(510),HISTORYMAXVERSION  DECIMAL(6,0),VIEWCOUNT  DECIMAL(12,0),CREATEUSER  VARCHAR(36),MODIFYUSER  VARCHAR(36),CREATEDATE   DATETIME YEAR TO SECOND ,MODIFYDATE   DATETIME YEAR TO SECOND ,PLDUTYDEPT  VARCHAR(36),PLDUTYPERSON  VARCHAR(128),LOCKUSER  VARCHAR(225),PUBLISHDATE   DATETIME YEAR TO SECOND ,CHANGEDATE   DATETIME YEAR TO SECOND ,STOPDATE   DATETIME YEAR TO SECOND ,ISSTOP  SMALLINT ,ISAPPROVAL  SMALLINT ,EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  LVARCHAR(510),EXT4  LVARCHAR(510), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_COPY(ID  VARCHAR(64) NOT NULL ,SHAPEGROUPTID  VARCHAR(64),SHAPENAME  VARCHAR(128),SHAPECATEGORYNAME  VARCHAR(64),PALREPOSITORYID  CHAR(36),ISDELETE  CHAR(1),SHAPETYPE  VARCHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_PASTE(ID  VARCHAR(64) NOT NULL ,SHAPEGROUPTID  VARCHAR(64),SHAPENAME  VARCHAR(128),SHAPECATEGORYNAME  VARCHAR(64),PALREPOSITORYID  CHAR(36),ISDELETE  CHAR(1),SHAPETYPE  VARCHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_RLAT(ID  CHAR(36) NOT NULL ,FILEID  VARCHAR(64),SHAPEID  VARCHAR(64),SHAPETEXT  VARCHAR(128),ATTRID  VARCHAR(64),RELATIONFILEID  VARCHAR(64),RELATIONSHAPEID  VARCHAR(64),RELATIONSHAPETEXT  VARCHAR(128), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_REPO_R(ID  CHAR(36) NOT NULL ,REMOVEID  CHAR(36),WSID  CHAR(36),PLRID  CHAR(36),PLNO  VARCHAR(36),PLNAME  VARCHAR(128),PLLEVEL  SMALLINT ,PLPARENTID  VARCHAR(36),PLORDERINDEX  SMALLINT ,PLISBOTTOMLEVEL  SMALLINT ,PLDESC  LVARCHAR(4000),PLRD  VARCHAR(36),PLRP  VARCHAR(36),PM  VARCHAR(36),PLINPUT  LVARCHAR(510),PLOUTPUT  LVARCHAR(510),PLEXECTYPE  SMALLINT ,PLSYSTEMNAME  VARCHAR(36),PLAWSPID  CHAR(36),PLDIAGRAMURL  LVARCHAR(510),PLCOLOR  VARCHAR(36),PLCATEGORY  VARCHAR(36),PLMETHODID  VARCHAR(36),PLVER  SMALLINT ,PLVERSIONID  CHAR(36),ISUSE  SMALLINT ,ISPUBLISH  SMALLINT ,ISSYSTEMFILE  SMALLINT ,FILEPATH  LVARCHAR(510),HISTORYMAXVERSION  DECIMAL(6,0),VIEWCOUNT  DECIMAL(12,0),CREATEUSER  VARCHAR(36),MODIFYUSER  VARCHAR(36),CREATEDATE   DATETIME YEAR TO SECOND ,MODIFYDATE   DATETIME YEAR TO SECOND ,PLDUTYDEPT  VARCHAR(36),PLDUTYPERSON  VARCHAR(128),ISSTOP  SMALLINT ,ISAPPROVAL  SMALLINT ,EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  LVARCHAR(510),EXT4  LVARCHAR(510), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_REPO_R_INFO(ID  CHAR(36) NOT NULL ,REMOVEUSER  VARCHAR(36),REMOVETIME   DATETIME YEAR TO SECOND ,WSID  VARCHAR(36),RESOURCEID  VARCHAR(36),REMOVETYPE  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_BACKUP(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),BACKUPTIME   DATETIME YEAR TO SECOND ,USERID  VARCHAR(36),REMARK  LVARCHAR(510),STATE  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PROP(ID  CHAR(36) NOT NULL ,PLID  CHAR(36),PROPERTYID  VARCHAR(100),PROPERTYNAME  VARCHAR(100),PROPERTYVALUE  LVARCHAR(4000),ORDERINDEX  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_CONFIG(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),METHODID  VARCHAR(36),SHAPEID  VARCHAR(100),ATTRIBUTE  LVARCHAR(510),ORDERINDEX  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_ATTR(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),ATTRID  VARCHAR(100),ATTRNAME  VARCHAR(100),ATTRVALUE  LVARCHAR(4000),CATEGORY  VARCHAR(36),METHODID  VARCHAR(36),TYPE  VARCHAR(36),ISDELETE  VARCHAR(10),ORDERINDEX  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_ATTR(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),ATTRID  VARCHAR(100),ATTRNAME  VARCHAR(100),ATTRVALUE  LVARCHAR(4000),CATEGORY  VARCHAR(36),METHODID  VARCHAR(36),TYPE  VARCHAR(36),SHAPENAME  VARCHAR(64),ORDERINDEX  SMALLINT , PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SPCL_PROP(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLID  CHAR(36),TYPE  CHAR(100),VALUETEXT  LVARCHAR(4000), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_CORRELATE(PLID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLAWSVERSIONID  CHAR(36),PLAWSID  CHAR(36),PLVERSIONID  VARCHAR(36),CORRELATETYPE  SMALLINT ,ISCORRELATE  SMALLINT ,EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  LVARCHAR(510),EXT4  LVARCHAR(510), PRIMARY KEY (PLID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH_COM(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLVERSIONID  CHAR(36),SORT  DECIMAL(16,0), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_TEAMMBR_PERM_EXT(ID  CHAR(36) NOT NULL ,BINDID  CHAR(36),RESOURCEID  CHAR(36), PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH_FREQ(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLVERSIONID  CHAR(36),COUNT  DECIMAL(16,0), PRIMARY KEY (ID)) ;

CREATE INDEX APP_ACT_COE_PAL_PUBLISH_IND1 ON  APP_ACT_COE_PAL_PUBLISH (PUBLISHDATE);
CREATE INDEX APP_ACT_COE_PAL_PUBLISH_L_I ON  APP_ACT_COE_PAL_PUBLISH_LIST (PID);
ALTER TABLE  APP_ACT_COE_PAL_USERGRP ADD CONSTRAINT APP_ACT_COE_PAL_USERGRP_UK UNIQUE (WSID,GROUPCODE);
ALTER TABLE  APP_ACT_COE_PAL_USERGRP_PERM ADD CONSTRAINT APP_ACT_COE_PAL_USERGRP_P_UK UNIQUE (GROUPID,PERMTYPE,RESOURCEID);
ALTER TABLE  APP_ACT_COE_PAL_USERGRP_ROLE ADD CONSTRAINT APP_ACT_COE_PAL_USERGRP_R_UK UNIQUE (GROUPID,ROLEID);
ALTER TABLE  APP_ACT_COE_TEAM_PERM ADD CONSTRAINT APP_ACT_COE_TEAM_PERM_UK UNIQUE (TEAMID,WSID,PERMTYPE,RESOURCEID);
ALTER TABLE  APP_ACT_COE_TEAMMBR_PERM ADD CONSTRAINT APP_ACT_COE_TEAMMBR_PERM_UK UNIQUE (TEAMID,USERID);
CREATE INDEX APP_ACT_COE_PAL_COMMENT_IND1 ON APP_ACT_COE_PAL_COMMENT (TARGETID,COMMENTDATE);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('e0583f9a-2f6e-49fe-b4e8-4b9a5f3c257a','AWS BPM',0);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('0df9d8b1-b082-4e3f-aadb-45fd76b82aeb','SAP ERP',0);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('cfbcec4a-b0ed-4e43-9866-bcda72d69eab','Oracle ERP',0);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('2a5faee5-0c12-4e29-b32e-aab42552ff6d','Oracle Siebel CRM',0);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('16f37ce8-dc62-4ffb-b6ca-fc248b51ff73','Oracle JDE ERP',0);

INSERT INTO APP_ACT_COE_PAL_SYSTEMNAME(ID,SYSTEMNAME,ISDEFAULT) VALUES('275e402a-a2c6-4d57-83a1-3f0da50539e4','Oracle PeopleSoft',0);

INSERT INTO APP_ACT_COE_PROP(PROPERTYKEY,PROPERTYVALUE) VALUES('CoE_Test','false');

INSERT INTO APP_ACT_COE_PROP(PROPERTYKEY,PROPERTYVALUE) VALUES('InitStep','6');

INSERT INTO APP_ACT_COE_USER(ID,USERID,ISADMIN) VALUES('9e23d27b-26a2-4ec5-839b-d9fe4c1eb9e3','admin',1);