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  DECIMAL(1),CREATEUSER  VARCHAR(36),CREATETIME  DATE ,CONSTRAINT PRIMARYAWS_COE_PAL_UPFILE1 PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_SHAPE_FILE(ID  VARCHAR(64) NOT NULL ,PALREPOSITORYID  CHAR(36),CONSTRAINT PRIMARYAWS_COE_PAL_SHAPE_FILE1 PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_SYSTEMNAME(ID  CHAR(36) NOT NULL ,SYSTEMNAME  VARCHAR(36),ISDEFAULT  DECIMAL(1),CONSTRAINT AWS_AWS_COE_PAL_AWSTEMNAME_PK PRIMARY KEY (ID)) ;

create table APP_ACT_COE_TEAM_PERM(ID  CHAR(36) NOT NULL ,TEAMID  CHAR(36),WSID  CHAR(36),PERMTYPE  DECIMAL(2),RESOURCEID  VARCHAR(128),CONSTRAINT PRIMARYAWS_COE_TEAM_PERM1 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),CONSTRAINT PRIMARYAWS_COE_TEAMMEMBER_PERM 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  TEXT ,CREATEUSER  VARCHAR(36),CREATEDATE  DATE ,CONSTRAINT PRIMARYAWS_COE_PAL_USERGROUP1 PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_USERGRP_PERM(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),PERMTYPE  DECIMAL(2),RESOURCEID  VARCHAR(128),CONSTRAINT PRIMARYAWS_COE_PAL_USERGROUP_P PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_USERGRP_ROLE(ID  CHAR(36) NOT NULL ,GROUPID  CHAR(36),ROLEID  VARCHAR(36),CONSTRAINT PRIMARYAWS_COE_PAL_USERGROUP_R 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  DECIMAL(1),TARGETID  CHAR(36),TEAMID  CHAR(36),USERID  VARCHAR(36),USERCOMMENT  TEXT ,COMMENTDATE  DATE ,INFOTYPE  DECIMAL(1),CONSTRAINT PRIMARYAWS_COE_PAL_COMMENT1 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  DATE ,PUBLISHDESC  TEXT ,PUBLISHN  DECIMAL(6),PUBLISHC  DECIMAL(6),PUBLISHS  DECIMAL(6),TEAMID  CHAR(36),CONSTRAINT PRIMARYAWS_COE_PAL_PUBLISH1 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  TEXT ,TASKID  CHAR(36),CONSTRAINT PRIMARYAWS_COE_PAL_PUBLISH_LIS 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  DATE ,BEGINTIME  DATE ,ENDTIME  DATE ,TASKSTATE  DECIMAL(1),THREADID  VARCHAR(128),LANG  VARCHAR(32),ISDISPLAY  VARCHAR(4),CONSTRAINT PRIMARYAWS_COE_PAL_OUTPUT_TASK PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PROP(PROPERTYKEY  VARCHAR(128) NOT NULL ,PROPERTYVALUE  CLOB ,CONSTRAINT AWS_AWS_COE_PROPERTY_PK PRIMARY KEY (PROPERTYKEY)) ;

create table APP_ACT_COE_USER(ID  CHAR(36) NOT NULL ,USERID  VARCHAR(36),ISADMIN  DECIMAL(1),CONSTRAINT AWS_AWS_COE_USER_PK PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_WORKSPACE(ID  CHAR(36) NOT NULL ,WSNAME  TEXT ,WSDM  TEXT ,WSADMIN  TEXT ,WSDESC  TEXT ,WSSTATE  DECIMAL(1),WSORGTYPE  DECIMAL(1),WSTCTYPE  DECIMAL(1),WSBGURL  TEXT ,WSORDERINDEX  DECIMAL(3),WSVER  DECIMAL(3),WSVERSIONUUID  CHAR(36),ISUSE  DECIMAL(1),CONSTRAINT AWS_AWS_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  VARCHAR(36),PLNAME  VARCHAR(128),PLLEVEL  DECIMAL(2),PLPARENTID  VARCHAR(36),PLORDERINDEX  DECIMAL(3),PLISBOTTOMLEVEL  DECIMAL(1),PLDESC  TEXT ,PLRD  VARCHAR(36),PLRP  VARCHAR(36),PM  VARCHAR(36),PLINPUT  TEXT ,PLOUTPUT  TEXT ,PLEXECTYPE  DECIMAL(1),PLSYSTEMNAME  VARCHAR(36),PLAWSPID  CHAR(36),PLDIAGRAMURL  TEXT ,PLCOLOR  VARCHAR(36),PLCATEGORY  VARCHAR(36),PLMETHODID  VARCHAR(36),PLVER  DECIMAL(3),PLVERSIONID  CHAR(36),ISUSE  DECIMAL(1),ISPUBLISH  DECIMAL(1),ISSYSTEMFILE  DECIMAL(1),FILEPATH  TEXT ,HISTORYMAXVERSION  DECIMAL(6),VIEWCOUNT  DECIMAL(12),CREATEUSER  VARCHAR(72),MODIFYUSER  VARCHAR(72),CREATEDATE  DATE ,MODIFYDATE  DATE ,PLDUTYDEPT  VARCHAR(36),PLDUTYPERSON  VARCHAR(128),LOCKUSER  VARCHAR(225),PUBLISHDATE  DATE ,CHANGEDATE  DATE ,STOPDATE  DATE ,ISSTOP  DECIMAL(1),ISAPPROVAL  DECIMAL(1),EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  TEXT ,EXT4  TEXT ,CONSTRAINT AWS_AWS_COE_PAL_REPOSITORY_PK 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),CONSTRAINT AWS_AWS_COE_PAL_SHAPE_COPY_PK 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),CONSTRAINT AWS_AWS_COE_PAL_SHAPE_PASTE_PK 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),CONSTRAINT PRIMARYAWS_COE_PAL_SHAPE_RELAT 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  DECIMAL(2),PLPARENTID  VARCHAR(36),PLORDERINDEX  DECIMAL(3),PLISBOTTOMLEVEL  DECIMAL(1),PLDESC  TEXT ,PLRD  VARCHAR(36),PLRP  VARCHAR(36),PM  VARCHAR(36),PLINPUT  TEXT ,PLOUTPUT  TEXT ,PLEXECTYPE  DECIMAL(1),PLSYSTEMNAME  VARCHAR(36),PLAWSPID  CHAR(36),PLDIAGRAMURL  TEXT ,PLCOLOR  VARCHAR(36),PLCATEGORY  VARCHAR(36),PLMETHODID  VARCHAR(36),PLVER  DECIMAL(3),PLVERSIONID  CHAR(36),ISUSE  DECIMAL(1),ISPUBLISH  DECIMAL(1),ISSYSTEMFILE  DECIMAL(1),FILEPATH  TEXT ,HISTORYMAXVERSION  DECIMAL(6),VIEWCOUNT  DECIMAL(12),CREATEUSER  VARCHAR(72),MODIFYUSER  VARCHAR(72),CREATEDATE  DATE ,MODIFYDATE  DATE ,PLDUTYDEPT  VARCHAR(36),PLDUTYPERSON  VARCHAR(128),ISSTOP  DECIMAL(1),ISAPPROVAL  DECIMAL(1),EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  TEXT ,EXT4  TEXT ,CONSTRAINT AWS_PAL_REPOSITORY_R_PK PRIMARY KEY (ID)) ;

create table APP_ACT_COE_PAL_REPO_R_INFO(ID  CHAR(36) NOT NULL ,REMOVEUSER  VARCHAR(36),REMOVETIME  DATE ,WSID  VARCHAR(36),RESOURCEID  VARCHAR(36),REMOVETYPE  DECIMAL(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  DATE ,USERID  VARCHAR(36),REMARK  TEXT ,STATE  DECIMAL(1),CONSTRAINT AWS_AWS_COE_PAL_BACKUP_PK 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  TEXT ,ORDERINDEX  DECIMAL(3),CONSTRAINT AWS_COE_PAL_PROPERTY_PK 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  TEXT ,ORDERINDEX  DECIMAL(3),CONSTRAINT AWS_COE_PAL_SHAPE_CONFIG_PK 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  TEXT ,CATEGORY  VARCHAR(36),METHODID  VARCHAR(36),TYPE  VARCHAR(36),ISDELETE  VARCHAR(10),ORDERINDEX  DECIMAL(3),CONSTRAINT AWS_COE_PAL_ATTRIBUTE_PK 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  TEXT ,CATEGORY  VARCHAR(36),METHODID  VARCHAR(36),TYPE  VARCHAR(36),SHAPENAME  VARCHAR(64),ORDERINDEX  DECIMAL(3),CONSTRAINT AWS_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  TEXT ,CONSTRAINT AWS_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  VARCHAR(36),CORRELATETYPE  DECIMAL(1),ISCORRELATE  DECIMAL(1),EXT1  VARCHAR(64),EXT2  VARCHAR(128),EXT3  TEXT ,EXT4  TEXT ,CONSTRAINT AWS_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  DECIMAL(16),CONSTRAINT AWS_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 AWS_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  DECIMAL(16),CONSTRAINT AWS_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);