CREATE TABLE APP_ACT_COE_PAL_UPFILE(ID  CHAR(36) NOT NULL ,PALREPOSITORYID  CHAR(36),SHAPEID  VARCHAR2(128),FILETYPE  CHAR(1),FILENAME  VARCHAR2(256),DOWNLOAD  NUMBER(1),CREATEUSER  VARCHAR2(72),CREATETIME  DATETIME ,CONSTRAINT APP_ACT_COE_PAL_UPFILE_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_FILE(ID  VARCHAR2(128) NOT NULL ,PALREPOSITORYID  CHAR(36),CONSTRAINT APP_ACT_COE_PAL_SHAPE_FILE_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SYSTEMNAME(ID  CHAR(36) NOT NULL ,SYSTEMNAME  VARCHAR2(72),ISDEFAULT  NUMBER(1),CONSTRAINT APP_ACT_COE_PAL_SYSTEMNAME_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_TEAM_PERM(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),WSID  CHAR(36),PERMTYPE  NUMBER(2),RESOURCEID  VARCHAR2(256),CONSTRAINT APP_ACT_COE_TEAM_PERM_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_TEAMMBR_PERM(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),USERID  VARCHAR2(72),ACTIONTYPE  VARCHAR2(128),EXTENDAPPS  VARCHAR2(450),CONSTRAINT APP_ACT_COE_TEAMMEMBER_PERM_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),GROUPCODE  VARCHAR2(72),CATEGORY  VARCHAR2(128),GROUPNAME  VARCHAR2(256),GROUPDESC  VARCHAR2(510),CREATEUSER  VARCHAR2(72),CREATEDATE  DATETIME ,CONSTRAINT APP_ACT_COE_PAL_USERGROUP_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP_PERM(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),PERMTYPE  NUMBER(2),RESOURCEID  VARCHAR2(256),CONSTRAINT APP_ACT_COE_PAL_USERGROUP_PERM_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_USERGRP_ROLE(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),ROLEID  VARCHAR2(72),CONSTRAINT APP_ACT_COE_PAL_USERGROUP_ROLE_PK 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  NUMBER(1),TARGETID  CHAR(36),TEAMID  CHAR(36),USERID  VARCHAR2(72),USERCOMMENT  VARCHAR2(2000),COMMENTDATE  DATETIME ,INFOTYPE  NUMBER(1),CONSTRAINT APP_ACT_COE_PAL_COMMENT_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH(ID  CHAR(36) NOT NULL ,PROCESSINSTID  VARCHAR2(72),WSID  CHAR(36),USERID  VARCHAR2(72),AUDITORID  VARCHAR2(72),PUBLISHDATE  DATETIME ,PUBLISHDESC  VARCHAR2(2000),PUBLISHN  NUMBER(6),PUBLISHC  NUMBER(6),PUBLISHS  NUMBER(6),TEAMID  CHAR(36),CONSTRAINT APP_ACT_COE_PAL_PUBLISH_PK 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  VARCHAR2(510),TASKID  CHAR(36),CONSTRAINT APP_ACT_COE_PAL_PUBLISH_LIST_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_OUTPUT_TASK(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),WSID  CHAR(36),PROFILEID  VARCHAR2(72),TASKNAME  VARCHAR2(128),USERID  VARCHAR2(72),CREATETIME  DATETIME ,BEGINTIME  DATETIME ,ENDTIME  DATETIME ,TASKSTATE  NUMBER(1),THREADID  VARCHAR2(256),LANG  VARCHAR2(64),ISDISPLAY  VARCHAR2(4),CONSTRAINT APP_ACT_COE_PAL_OUTPUT_TASK_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PROP(PROPERTYKEY  VARCHAR2(256) NOT NULL ,PROPERTYVALUE  CLOB ,CONSTRAINT APP_ACT_COE_PROPERTY_PK PRIMARY KEY (PROPERTYKEY)) ;

CREATE TABLE APP_ACT_COE_USER(ID  CHAR(36) NOT NULL ,USERID  VARCHAR2(72),ISADMIN  NUMBER(1),CONSTRAINT APP_ACT_COE_USER_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_WORKSPACE(ID  CHAR(36) NOT NULL ,WSNAME  VARCHAR2(510),WSDM  VARCHAR2(510),WSADMIN  VARCHAR2(510),WSDESC  VARCHAR2(510),WSSTATE  NUMBER(1),WSORGTYPE  NUMBER(1),WSTCTYPE  NUMBER(1),WSBGURL  VARCHAR2(510),WSORDERINDEX  NUMBER(3),WSVER  NUMBER(3),WSVERSIONUUID  CHAR(36),ISUSE  NUMBER(1),CONSTRAINT APP_ACT_COE_PAL_WORKSPACE_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_REPOSITORY(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLRID  CHAR(36),PLNO  VARCHAR2(72),PLNAME  VARCHAR2(256),PLLEVEL  NUMBER(2),PLPARENTID  VARCHAR2(72),PLORDERINDEX  NUMBER(3),PLISBOTTOMLEVEL  NUMBER(1),PLDESC  VARCHAR2(4000),PLRD  VARCHAR2(72),PLRP  VARCHAR2(72),PM  VARCHAR2(72),PLINPUT  VARCHAR2(510),PLOUTPUT  VARCHAR2(510),PLEXECTYPE  NUMBER(1),PLSYSTEMNAME  VARCHAR2(72),PLAWSPID  CHAR(36),PLDIAGRAMURL  VARCHAR2(510),PLCOLOR  VARCHAR2(72),PLCATEGORY  VARCHAR2(72),PLMETHODID  VARCHAR2(72),PLVER  NUMBER(3),PLVERSIONID  CHAR(36),ISUSE  NUMBER(1),ISPUBLISH  NUMBER(1),ISSYSTEMFILE  NUMBER(1),FILEPATH  VARCHAR2(510),HISTORYMAXVERSION  NUMBER(6),VIEWCOUNT  NUMBER(12),CREATEUSER  VARCHAR2(72),MODIFYUSER  VARCHAR2(72),CREATEDATE  DATETIME ,MODIFYDATE  DATETIME ,PLDUTYDEPT  VARCHAR2(72),PLDUTYPERSON  VARCHAR2(256),LOCKUSER  VARCHAR2(450),PUBLISHDATE  DATETIME ,CHANGEDATE  DATETIME ,STOPDATE  DATETIME ,ISSTOP  NUMBER(1),ISAPPROVAL  NUMBER(1),EXT1  VARCHAR2(128),EXT2  VARCHAR2(256),EXT3  VARCHAR2(510),EXT4  VARCHAR2(510),CONSTRAINT APP_ACT_COE_PAL_REPOSITORY_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_COPY(ID  VARCHAR2(128) NOT NULL ,SHAPEGROUPTID  VARCHAR2(128),SHAPENAME  VARCHAR2(256),SHAPECATEGORYNAME  VARCHAR2(128),PALREPOSITORYID  CHAR(36),ISDELETE  CHAR(1),SHAPETYPE  VARCHAR2(72),CONSTRAINT APP_ACT_COE_PAL_SHAPE_COPY_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_PASTE(ID  VARCHAR2(128) NOT NULL ,SHAPEGROUPTID  VARCHAR2(128),SHAPENAME  VARCHAR2(256),SHAPECATEGORYNAME  VARCHAR2(128),PALREPOSITORYID  CHAR(36),ISDELETE  CHAR(1),SHAPETYPE  VARCHAR2(72),CONSTRAINT APP_ACT_COE_PAL_SHAPE_PASTE_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_RLAT(ID  CHAR(36) NOT NULL ,FILEID  VARCHAR2(128),SHAPEID  VARCHAR2(128),SHAPETEXT  VARCHAR2(256),ATTRID  VARCHAR2(128),RELATIONFILEID  VARCHAR2(128),RELATIONSHAPEID  VARCHAR2(128),RELATIONSHAPETEXT  VARCHAR2(256),CONSTRAINT APP_ACT_COE_PAL_SHAPE_RT_PK 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  VARCHAR2(72),PLNAME  VARCHAR2(256),PLLEVEL  NUMBER(2),PLPARENTID  VARCHAR2(72),PLORDERINDEX  NUMBER(3),PLISBOTTOMLEVEL  NUMBER(1),PLDESC  VARCHAR2(4000),PLRD  VARCHAR2(72),PLRP  VARCHAR2(72),PM  VARCHAR2(72),PLINPUT  VARCHAR2(510),PLOUTPUT  VARCHAR2(510),PLEXECTYPE  NUMBER(1),PLSYSTEMNAME  VARCHAR2(72),PLAWSPID  CHAR(36),PLDIAGRAMURL  VARCHAR2(510),PLCOLOR  VARCHAR2(72),PLCATEGORY  VARCHAR2(72),PLMETHODID  VARCHAR2(72),PLVER  NUMBER(3),PLVERSIONID  CHAR(36),ISUSE  NUMBER(1),ISPUBLISH  NUMBER(1),ISSYSTEMFILE  NUMBER(1),FILEPATH  VARCHAR2(510),HISTORYMAXVERSION  NUMBER(6),VIEWCOUNT  NUMBER(12),CREATEUSER  VARCHAR2(72),MODIFYUSER  VARCHAR2(72),CREATEDATE  DATETIME ,MODIFYDATE  DATETIME ,PLDUTYDEPT  VARCHAR2(72),PLDUTYPERSON  VARCHAR2(256),ISSTOP  NUMBER(1),ISAPPROVAL  NUMBER(1),EXT1  VARCHAR2(128),EXT2  VARCHAR2(256),EXT3  VARCHAR2(510),EXT4  VARCHAR2(510),CONSTRAINT AWS_PAL_REPOSITORY_R_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_REPO_R_INFO(ID  CHAR(36) NOT NULL ,REMOVEUSER  VARCHAR2(72),REMOVETIME  DATETIME ,WSID  VARCHAR2(72),RESOURCEID  VARCHAR2(72),REMOVETYPE  NUMBER(1),CONSTRAINT AWS_PAL_REPOSITORY_R_INFO_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_BACKUP(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),BACKUPTIME  DATETIME ,USERID  VARCHAR2(72),REMARK  VARCHAR2(510),STATE  NUMBER(1),CONSTRAINT APP_ACT_COE_PAL_BACKUP_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_PROP(ID  CHAR(36) NOT NULL ,PLID  CHAR(36),PROPERTYID  VARCHAR2(200),PROPERTYNAME  VARCHAR2(200),PROPERTYVALUE  VARCHAR2(4000),ORDERINDEX  NUMBER(3),CONSTRAINT APP_ACT_COE_PAL_PROPERTY_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_CONFIG(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),METHODID  VARCHAR2(72),SHAPEID  VARCHAR2(200),ATTRIBUTE  VARCHAR2(510),ORDERINDEX  NUMBER(3),CONSTRAINT APP_ACT_COE_PAL_SHAPE_CONFIG_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_ATTR(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),ATTRID  VARCHAR2(200),ATTRNAME  VARCHAR2(200),ATTRVALUE  VARCHAR2(4000),CATEGORY  VARCHAR2(72),METHODID  VARCHAR2(72),TYPE  VARCHAR2(72),ISDELETE  VARCHAR2(20),ORDERINDEX  NUMBER(3),CONSTRAINT APP_ACT_COE_PAL_ATTRIBUTE_PK PRIMARY KEY (ID)) ;

CREATE TABLE APP_ACT_COE_PAL_SHAPE_ATTR(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),ATTRID  VARCHAR2(200),ATTRNAME  VARCHAR2(200),ATTRVALUE  VARCHAR2(4000),CATEGORY  VARCHAR2(72),METHODID  VARCHAR2(72),TYPE  VARCHAR2(72),SHAPENAME  VARCHAR2(128),ORDERINDEX  NUMBER(3),CONSTRAINT APP_ACT_COE_PAL_SHAPE_ATTRIBUTE_PK 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  VARCHAR2(4000),CONSTRAINT APP_ACT_COE_PAL_SPECIAL_PK 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  VARCHAR2(72),CORRELATETYPE  NUMBER(1),ISCORRELATE  NUMBER(1),EXT1  VARCHAR2(128),EXT2  VARCHAR2(256),EXT3  VARCHAR2(510),EXT4  VARCHAR2(510),CONSTRAINT APP_ACT_COE_PAL_CORRELATE_PK PRIMARY KEY (PLID)) ;

CREATE TABLE APP_ACT_COE_PAL_PUBLISH_COM(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLVERSIONID  CHAR(36),SORT  NUMBER(16),CONSTRAINT APP_ACT_COE_PAL_COMMON_PK PRIMARY KEY (ID)) ;

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

CREATE TABLE APP_ACT_COE_PAL_PUBLISH_FREQ(ID  CHAR(36) NOT NULL ,WSID  CHAR(36),PLVERSIONID  CHAR(36),COUNT  NUMBER(16),CONSTRAINT APP_ACT_COE_PAL_FREQUENCY_PK 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);