From 45e2463de6e374f53b1f35f619591b732aa48147 Mon Sep 17 00:00:00 2001 From: jensp Date: Fri, 18 Nov 2016 13:53:28 +0000 Subject: [PATCH] CCM NG: DB migrations scripts for recent changes of workflow classes, changed datasets for tests to match new structure git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4445 8810af33-2d31-482b-a856-94f89814c4df --- .../ccm_cms/h2/V7_0_0_9__workflow.sql | 21 ++ .../ccm_cms/pgsql/V7_0_0_9__workflow.sql | 20 ++ .../scripts/create_ccm_cms_schema.sql | 226 +++++++---------- .../scripts/create_ccm_cms_schema.sql | 227 +++++++----------- .../datasets/create_ccm_cms_schema.sql | 226 +++++++---------- .../after-copy-to-folder-in-other-section.xml | 50 ++-- .../after-copy-to-other-folder.xml | 50 ++-- .../after-copy-to-same-folder.xml | 56 +++-- ...after-create-contentitem-with-workflow.xml | 62 ++--- .../after-create-contentitem.xml | 69 +++--- .../after-move-to-other-section.xml | 54 +++-- .../ContentItemManagerTest/after-move.xml | 50 ++-- .../ContentItemManagerTest/after-publish.xml | 50 ++-- .../after-republish.xml | 51 ++-- .../after-unpublish.xml | 58 +++-- .../ContentItemManagerTest/data.xml | 50 ++-- .../after-add-contenttype.xml | 10 +- .../after-add-role.xml | 9 +- .../after-create.xml | 10 +- .../after-remove-contenttype.xml | 9 +- .../after-remove-role.xml | 9 +- .../after-rename.xml | 9 +- .../ContentSectionManagerTest/data.xml | 9 +- .../main/java/org/libreccm/workflow/Task.java | 2 +- .../org/libreccm/workflow/TaskAssignment.java | 2 +- .../ccm_core/h2/V7_0_0_9__workflow.sql | 88 +++++++ .../ccm_core/pgsql/V7_0_0_9__workflow.sql | 87 +++++++ .../scripts/create_ccm_core_schema.sql | 75 +++--- .../scripts/create_ccm_core_schema.sql | 75 +++--- 29 files changed, 953 insertions(+), 761 deletions(-) create mode 100644 ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/h2/V7_0_0_9__workflow.sql create mode 100644 ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/pgsql/V7_0_0_9__workflow.sql create mode 100644 ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_9__workflow.sql create mode 100644 ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_9__workflow.sql diff --git a/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/h2/V7_0_0_9__workflow.sql b/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/h2/V7_0_0_9__workflow.sql new file mode 100644 index 000000000..03def4149 --- /dev/null +++ b/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/h2/V7_0_0_9__workflow.sql @@ -0,0 +1,21 @@ +-- drop unused tables + +drop table ccm_cms.article_leads; + +drop table ccm_cms.task_event_url_generator; + +alter table CCM_CMS.WORKFLOW_TASKS + add column TASK_TYPE varchar(255); + +alter table CCM_CMS.WORKFLOW_TASKS + drop column task_type_id; + +alter table CCM_CMS.WORKFLOW_TASKS + add constraint fkoon3rwfmg0lhgbj4un4q3otya + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + +drop table CCM_CMS.WORKFLOW_TASK_TYPES; + + + diff --git a/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/pgsql/V7_0_0_9__workflow.sql b/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/pgsql/V7_0_0_9__workflow.sql new file mode 100644 index 000000000..ed56a9479 --- /dev/null +++ b/ccm-cms/src/main/resources/db/migrations/org/librecms/ccm_cms/pgsql/V7_0_0_9__workflow.sql @@ -0,0 +1,20 @@ +-- drop unused tables + +drop table ccm_cms.article_leads; + +drop table ccm_cms.task_event_url_generator; + +alter table CCM_CMS.WORKFLOW_TASKS + add column TASK_TYPE varchar(255); + +alter table CCM_CMS.WORKFLOW_TASKS + drop column task_type_id; + +alter table CCM_CMS.WORKFLOW_TASKS + add constraint fkoon3rwfmg0lhgbj4un4q3otya + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + +drop table CCM_CMS.WORKFLOW_TASK_TYPES; + + diff --git a/ccm-cms/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_cms_schema.sql b/ccm-cms/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_cms_schema.sql index 8faf1c5fd..a34bfaa07 100644 --- a/ccm-cms/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_cms_schema.sql +++ b/ccm-cms/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_cms_schema.sql @@ -1,17 +1,3 @@ -DROP SCHEMA IF EXISTS ccm_cms; -DROP SCHEMA IF EXISTS ccm_core; - -DROP SEQUENCE IF EXISTS hibernate_sequence; - -CREATE SCHEMA ccm_core; -CREATE SCHEMA ccm_cms; - - create table CCM_CMS.ARTICLE_LEADS ( - OBJECT_ID bigint not null, - LOCALIZED_VALUE longvarchar, - LOCALE varchar(255) not null, - primary key (OBJECT_ID, LOCALE) - ); create table CCM_CMS.ARTICLE_TEXTS ( OBJECT_ID bigint not null, @@ -109,7 +95,6 @@ CREATE SCHEMA ccm_cms; LIST_ORDER bigint, UUID varchar(255), ITEM_ID bigint, - CONTENT_ITEM_ID bigint, primary key (LIST_ID) ); @@ -355,15 +340,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID) ); - create table CCM_CMS.ContentItem_AttachmentList_AUD ( - REV integer not null, - CONTENT_ITEM_ID bigint not null, - LIST_ID bigint not null, - REVTYPE tinyint, - REVEND integer, - primary key (REV, CONTENT_ITEM_ID, LIST_ID) - ); - create table CCM_CMS.EVENT_COSTS ( OBJECT_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -844,15 +820,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.TASK_EVENT_URL_GENERATOR ( - GENERATOR_ID bigint not null, - EVENT varchar(256), - URL_GENERATOR_CLASS varchar(1024), - CONTENT_TYPE_ID bigint, - TASK_TYPE_ID bigint, - primary key (GENERATOR_ID) - ); - create table CCM_CMS.VIDEO_ASSETS ( HEIGHT bigint, WIDTH bigint, @@ -870,16 +837,9 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.WORKFLOW_TASK_TYPES ( - TASK_TYPE_ID bigint not null, - DEFAULT_URL_GENERATOR_CLASS varchar(1024), - PRIVILEGE varchar(256), - primary key (TASK_TYPE_ID) - ); - create table CCM_CMS.WORKFLOW_TASKS ( + TASK_TYPE varchar(255), TASK_ID bigint not null, - TASK_TYPE_ID bigint, primary key (TASK_ID) ); @@ -1383,10 +1343,10 @@ CREATE SCHEMA ccm_cms; CONFIGURATION_CLASS varchar(512) not null, NAME varchar(512) not null, SETTING_VALUE_BIG_DECIMAL decimal(19,2), - SETTING_VALUE_STRING varchar(1024), - SETTING_VALUE_DOUBLE double, SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_LONG bigint, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_DOUBLE double, primary key (SETTING_ID) ); @@ -1407,13 +1367,6 @@ CREATE SCHEMA ccm_cms; value varchar(255) ); - create table CCM_CORE.TASK_ASSIGNMENTS ( - TASK_ASSIGNMENT_ID bigint not null, - ROLE_ID bigint, - TASK_ID bigint, - primary key (TASK_ASSIGNMENT_ID) - ); - create table CCM_CORE.THREADS ( OBJECT_ID bigint not null, ROOT_ID bigint, @@ -1440,6 +1393,17 @@ CREATE SCHEMA ccm_cms; primary key (PARTY_ID) ); + create table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS ( + DUE_DATE timestamp, + DURATION_MINUTES bigint, + LOCKED boolean, + START_DATE timestamp, + TASK_ID bigint not null, + LOCKING_USER_ID bigint, + NOTIFICATION_SENDER bigint, + primary key (TASK_ID) + ); + create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( WORKFLOW_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -1454,9 +1418,20 @@ CREATE SCHEMA ccm_cms; primary key (WORKFLOW_ID, LOCALE) ); + create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID bigint not null, + ROLE_ID bigint, + TASK_ID bigint, + primary key (TASK_ASSIGNMENT_ID) + ); + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( - TASK_ID bigint not null, - COMMENT clob + COMMENT_ID bigint not null, + COMMENT longvarchar, + UUID varchar(255) not null, + AUTHOR_ID bigint, + TASK_ID bigint, + primary key (COMMENT_ID) ); create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES ( @@ -1464,6 +1439,13 @@ CREATE SCHEMA ccm_cms; DEPENDENT_TASK_ID bigint not null ); + create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( + TASK_ID bigint not null, + LOCALIZED_VALUE longvarchar, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + create table CCM_CORE.WORKFLOW_TASK_LABELS ( TASK_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -1475,35 +1457,23 @@ CREATE SCHEMA ccm_cms; TASK_ID bigint not null, ACTIVE boolean, TASK_STATE varchar(512), + UUID varchar(255) not null, WORKFLOW_ID bigint, primary key (TASK_ID) ); - create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( - TASK_ID bigint not null, - LOCALIZED_VALUE longvarchar, - LOCALE varchar(255) not null, - primary key (TASK_ID, LOCALE) - ); - create table CCM_CORE.WORKFLOW_TEMPLATES ( WORKFLOW_ID bigint not null, primary key (WORKFLOW_ID) ); - create table CCM_CORE.WORKFLOW_USER_TASKS ( - DUE_DATE timestamp, - DURATION_MINUTES bigint, - LOCKED boolean, - START_DATE timestamp, - TASK_ID bigint not null, - LOCKING_USER_ID bigint, - NOTIFICATION_SENDER bigint, - primary key (TASK_ID) - ); - create table CCM_CORE.WORKFLOWS ( WORKFLOW_ID bigint not null, + ACTIVE boolean, + WORKFLOW_STATE varchar(255), + TASKS_STATE varchar(255), + UUID varchar(255) not null, + OBJECT_ID bigint, TEMPLATE_ID bigint, primary key (WORKFLOW_ID) ); @@ -1525,12 +1495,16 @@ CREATE SCHEMA ccm_cms; alter table CCM_CORE.SETTINGS add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); -create sequence hibernate_sequence start with 1 increment by 1; - alter table CCM_CMS.ARTICLE_LEADS - add constraint FK4g66u3qtfyepw0f733kuiiaul - foreign key (OBJECT_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + + alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); +create sequence hibernate_sequence start with 1 increment by 1; alter table CCM_CMS.ARTICLE_TEXTS add constraint FK1pel1j53h3t3adh9o5cbje2d3 @@ -1617,11 +1591,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (ITEM_ID) references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS - add constraint FK4c7jp8622b8m8nvdvdajnt0am - foreign key (CONTENT_ITEM_ID) - references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS_AUD add constraint FKgdt5p8huh1lhk299hkrytqmqc foreign key (REV) @@ -1862,16 +1831,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (OBJECT_ID) references CCM_CORE.CCM_OBJECTS; - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK4notdhn18abev1asay7cmyy84 - foreign key (REV) - references CCM_CORE.CCM_REVISIONS; - - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK16sw895gdgghrymbirrgrvxsa - foreign key (REVEND) - references CCM_CORE.CCM_REVISIONS; - alter table CCM_CMS.EVENT_COSTS add constraint FKrbmepytotc73h5inefeih6rea foreign key (OBJECT_ID) @@ -2287,16 +2246,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (OBJECT_ID, REV) references CCM_CMS.ASSETS_AUD; - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKjjasedpc2ef91iknmiyqwhxrs - foreign key (CONTENT_TYPE_ID) - references CCM_CMS.CONTENT_TYPES; - - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKi3tnip5gr0i5hvw8skw21pveh - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - alter table CCM_CMS.VIDEO_ASSETS add constraint FKjuywvv7wq9pyid5b6ivyrc0yk foreign key (LEGAL_METADATA_ID) @@ -2313,14 +2262,9 @@ create sequence hibernate_sequence start with 1 increment by 1; references CCM_CMS.BINARY_ASSETS_AUD; alter table CCM_CMS.WORKFLOW_TASKS - add constraint FK1sk7ouwhx9r3buxvbfvfa7nnm - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - - alter table CCM_CMS.WORKFLOW_TASKS - add constraint FKge2x94m1y9tr7mk26ensyn674 + add constraint FKoon3rwfmg0lhgbj4un4q3otya foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; alter table CCM_CORE.APPLICATIONS add constraint FKatcp9ij6mbkx0nfeig1o6n3lm @@ -2727,16 +2671,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (LIST_ID) references CCM_CORE.SETTINGS; - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKe29uwmvxdmol1fjob3auej4qv - foreign key (ROLE_ID) - references CCM_CORE.CCM_ROLES; - - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKc1vovbjg9mp5yegx2fdoutx7u - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; - alter table CCM_CORE.THREADS add constraint FKsx08mpwvwnw97uwdgjs76q39g foreign key (ROOT_ID) @@ -2757,6 +2691,21 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (PARTY_ID) references CCM_CORE.PARTIES; + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK1pnsq9ur3ylq0ghuj23p4cogs + foreign key (LOCKING_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK9ngp088m8xa82swy7yg3qx6vh + foreign key (NOTIFICATION_SENDER) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FKt9ha3no3bj8a50pnw8cnqh2cq + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_DESCRIPTIONS add constraint FKgx7upkqky82dpxvbs95imfl9l foreign key (WORKFLOW_ID) @@ -2767,6 +2716,21 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FKpq4paqtfbi5erhh98wl1ja005 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FK3933ol31co3yn5ee75b2hmhgp + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKd2ymdg8nay9pmh2nn2whba0j8 + foreign key (AUTHOR_ID) + references CCM_CORE.USERS; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS add constraint FKkfqrf9jdvm7livu5if06w0r5t foreign key (TASK_ID) @@ -2782,6 +2746,11 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (DEPENDS_ON_TASK_ID) references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint FKeb7mqbdx3bk7t01vo7kp2hpf + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_LABELS add constraint FKf715qud6g9xv2xeb8rrpnv4xs foreign key (TASK_ID) @@ -2792,30 +2761,15 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS - add constraint FK2s2498d2tpojjrtghq7iyaosv - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; - alter table CCM_CORE.WORKFLOW_TEMPLATES add constraint FK8692vdme4yxnkj1m0k1dw74pk foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKf09depwj5rgso2dair07vnu33 - foreign key (LOCKING_USER_ID) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FK6evo9y34awhdfcyl8gv78qb7f - foreign key (NOTIFICATION_SENDER) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKefpdf9ojplu7loo31hfm0wl2h - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOWS + add constraint FKrm2yfrs6veoxoy304upq2wc64 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; alter table CCM_CORE.WORKFLOWS add constraint FKeixdxau4jebw682gd49tdbsjy diff --git a/ccm-cms/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_cms_schema.sql b/ccm-cms/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_cms_schema.sql index 3daa47681..075b01aa7 100644 --- a/ccm-cms/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_cms_schema.sql +++ b/ccm-cms/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_cms_schema.sql @@ -1,18 +1,3 @@ -DROP SCHEMA IF EXISTS ccm_cms CASCADE; -DROP SCHEMA IF EXISTS ccm_core CASCADE; - -DROP SEQUENCE IF EXISTS hibernate_sequence; - -CREATE SCHEMA ccm_core; -CREATE SCHEMA ccm_cms; - - - create table CCM_CMS.ARTICLE_LEADS ( - OBJECT_ID int8 not null, - LOCALIZED_VALUE text, - LOCALE varchar(255) not null, - primary key (OBJECT_ID, LOCALE) - ); create table CCM_CMS.ARTICLE_TEXTS ( OBJECT_ID int8 not null, @@ -110,7 +95,6 @@ CREATE SCHEMA ccm_cms; LIST_ORDER int8, UUID varchar(255), ITEM_ID int8, - CONTENT_ITEM_ID int8, primary key (LIST_ID) ); @@ -356,15 +340,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID) ); - create table CCM_CMS.ContentItem_AttachmentList_AUD ( - REV int4 not null, - CONTENT_ITEM_ID int8 not null, - LIST_ID int8 not null, - REVTYPE int2, - REVEND int4, - primary key (REV, CONTENT_ITEM_ID, LIST_ID) - ); - create table CCM_CMS.EVENT_COSTS ( OBJECT_ID int8 not null, LOCALIZED_VALUE text, @@ -845,15 +820,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.TASK_EVENT_URL_GENERATOR ( - GENERATOR_ID int8 not null, - EVENT varchar(256), - URL_GENERATOR_CLASS varchar(1024), - CONTENT_TYPE_ID int8, - TASK_TYPE_ID int8, - primary key (GENERATOR_ID) - ); - create table CCM_CMS.VIDEO_ASSETS ( HEIGHT int8, WIDTH int8, @@ -871,16 +837,9 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.WORKFLOW_TASK_TYPES ( - TASK_TYPE_ID int8 not null, - DEFAULT_URL_GENERATOR_CLASS varchar(1024), - PRIVILEGE varchar(256), - primary key (TASK_TYPE_ID) - ); - create table CCM_CMS.WORKFLOW_TASKS ( + TASK_TYPE varchar(255), TASK_ID int8 not null, - TASK_TYPE_ID int8, primary key (TASK_ID) ); @@ -1384,10 +1343,10 @@ CREATE SCHEMA ccm_cms; CONFIGURATION_CLASS varchar(512) not null, NAME varchar(512) not null, SETTING_VALUE_BIG_DECIMAL numeric(19, 2), - SETTING_VALUE_STRING varchar(1024), - SETTING_VALUE_DOUBLE float8, SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_LONG int8, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_DOUBLE float8, primary key (SETTING_ID) ); @@ -1408,13 +1367,6 @@ CREATE SCHEMA ccm_cms; value varchar(255) ); - create table CCM_CORE.TASK_ASSIGNMENTS ( - TASK_ASSIGNMENT_ID int8 not null, - ROLE_ID int8, - TASK_ID int8, - primary key (TASK_ASSIGNMENT_ID) - ); - create table CCM_CORE.THREADS ( OBJECT_ID int8 not null, ROOT_ID int8, @@ -1441,6 +1393,17 @@ CREATE SCHEMA ccm_cms; primary key (PARTY_ID) ); + create table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS ( + DUE_DATE timestamp, + DURATION_MINUTES int8, + LOCKED boolean, + START_DATE timestamp, + TASK_ID int8 not null, + LOCKING_USER_ID int8, + NOTIFICATION_SENDER int8, + primary key (TASK_ID) + ); + create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( WORKFLOW_ID int8 not null, LOCALIZED_VALUE text, @@ -1455,9 +1418,20 @@ CREATE SCHEMA ccm_cms; primary key (WORKFLOW_ID, LOCALE) ); + create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID int8 not null, + ROLE_ID int8, + TASK_ID int8, + primary key (TASK_ASSIGNMENT_ID) + ); + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( - TASK_ID int8 not null, - COMMENT text + COMMENT_ID int8 not null, + COMMENT text, + UUID varchar(255) not null, + AUTHOR_ID int8, + TASK_ID int8, + primary key (COMMENT_ID) ); create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES ( @@ -1465,6 +1439,13 @@ CREATE SCHEMA ccm_cms; DEPENDENT_TASK_ID int8 not null ); + create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( + TASK_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + create table CCM_CORE.WORKFLOW_TASK_LABELS ( TASK_ID int8 not null, LOCALIZED_VALUE text, @@ -1476,35 +1457,23 @@ CREATE SCHEMA ccm_cms; TASK_ID int8 not null, ACTIVE boolean, TASK_STATE varchar(512), + UUID varchar(255) not null, WORKFLOW_ID int8, primary key (TASK_ID) ); - create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( - TASK_ID int8 not null, - LOCALIZED_VALUE text, - LOCALE varchar(255) not null, - primary key (TASK_ID, LOCALE) - ); - create table CCM_CORE.WORKFLOW_TEMPLATES ( WORKFLOW_ID int8 not null, primary key (WORKFLOW_ID) ); - create table CCM_CORE.WORKFLOW_USER_TASKS ( - DUE_DATE timestamp, - DURATION_MINUTES int8, - LOCKED boolean, - START_DATE timestamp, - TASK_ID int8 not null, - LOCKING_USER_ID int8, - NOTIFICATION_SENDER int8, - primary key (TASK_ID) - ); - create table CCM_CORE.WORKFLOWS ( WORKFLOW_ID int8 not null, + ACTIVE boolean, + WORKFLOW_STATE varchar(255), + TASKS_STATE varchar(255), + UUID varchar(255) not null, + OBJECT_ID int8, TEMPLATE_ID int8, primary key (WORKFLOW_ID) ); @@ -1526,12 +1495,16 @@ CREATE SCHEMA ccm_cms; alter table CCM_CORE.SETTINGS add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); -create sequence hibernate_sequence start 1 increment 1; - alter table CCM_CMS.ARTICLE_LEADS - add constraint FK4g66u3qtfyepw0f733kuiiaul - foreign key (OBJECT_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + + alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); +create sequence hibernate_sequence start 1 increment 1; alter table CCM_CMS.ARTICLE_TEXTS add constraint FK1pel1j53h3t3adh9o5cbje2d3 @@ -1618,11 +1591,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (ITEM_ID) references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS - add constraint FK4c7jp8622b8m8nvdvdajnt0am - foreign key (CONTENT_ITEM_ID) - references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS_AUD add constraint FKgdt5p8huh1lhk299hkrytqmqc foreign key (REV) @@ -1863,16 +1831,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (OBJECT_ID) references CCM_CORE.CCM_OBJECTS; - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK4notdhn18abev1asay7cmyy84 - foreign key (REV) - references CCM_CORE.CCM_REVISIONS; - - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK16sw895gdgghrymbirrgrvxsa - foreign key (REVEND) - references CCM_CORE.CCM_REVISIONS; - alter table CCM_CMS.EVENT_COSTS add constraint FKrbmepytotc73h5inefeih6rea foreign key (OBJECT_ID) @@ -2288,16 +2246,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (OBJECT_ID, REV) references CCM_CMS.ASSETS_AUD; - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKjjasedpc2ef91iknmiyqwhxrs - foreign key (CONTENT_TYPE_ID) - references CCM_CMS.CONTENT_TYPES; - - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKi3tnip5gr0i5hvw8skw21pveh - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - alter table CCM_CMS.VIDEO_ASSETS add constraint FKjuywvv7wq9pyid5b6ivyrc0yk foreign key (LEGAL_METADATA_ID) @@ -2314,14 +2262,9 @@ create sequence hibernate_sequence start 1 increment 1; references CCM_CMS.BINARY_ASSETS_AUD; alter table CCM_CMS.WORKFLOW_TASKS - add constraint FK1sk7ouwhx9r3buxvbfvfa7nnm - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - - alter table CCM_CMS.WORKFLOW_TASKS - add constraint FKge2x94m1y9tr7mk26ensyn674 + add constraint FKoon3rwfmg0lhgbj4un4q3otya foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; alter table CCM_CORE.APPLICATIONS add constraint FKatcp9ij6mbkx0nfeig1o6n3lm @@ -2728,16 +2671,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (LIST_ID) references CCM_CORE.SETTINGS; - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKe29uwmvxdmol1fjob3auej4qv - foreign key (ROLE_ID) - references CCM_CORE.CCM_ROLES; - - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKc1vovbjg9mp5yegx2fdoutx7u - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; - alter table CCM_CORE.THREADS add constraint FKsx08mpwvwnw97uwdgjs76q39g foreign key (ROOT_ID) @@ -2758,6 +2691,21 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (PARTY_ID) references CCM_CORE.PARTIES; + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK1pnsq9ur3ylq0ghuj23p4cogs + foreign key (LOCKING_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK9ngp088m8xa82swy7yg3qx6vh + foreign key (NOTIFICATION_SENDER) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FKt9ha3no3bj8a50pnw8cnqh2cq + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_DESCRIPTIONS add constraint FKgx7upkqky82dpxvbs95imfl9l foreign key (WORKFLOW_ID) @@ -2768,6 +2716,21 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FKpq4paqtfbi5erhh98wl1ja005 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FK3933ol31co3yn5ee75b2hmhgp + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKd2ymdg8nay9pmh2nn2whba0j8 + foreign key (AUTHOR_ID) + references CCM_CORE.USERS; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS add constraint FKkfqrf9jdvm7livu5if06w0r5t foreign key (TASK_ID) @@ -2783,6 +2746,11 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (DEPENDS_ON_TASK_ID) references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint FKeb7mqbdx3bk7t01vo7kp2hpf + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_LABELS add constraint FKf715qud6g9xv2xeb8rrpnv4xs foreign key (TASK_ID) @@ -2793,30 +2761,15 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS - add constraint FK2s2498d2tpojjrtghq7iyaosv - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; - alter table CCM_CORE.WORKFLOW_TEMPLATES add constraint FK8692vdme4yxnkj1m0k1dw74pk foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKf09depwj5rgso2dair07vnu33 - foreign key (LOCKING_USER_ID) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FK6evo9y34awhdfcyl8gv78qb7f - foreign key (NOTIFICATION_SENDER) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKefpdf9ojplu7loo31hfm0wl2h - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOWS + add constraint FKrm2yfrs6veoxoy304upq2wc64 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; alter table CCM_CORE.WORKFLOWS add constraint FKeixdxau4jebw682gd49tdbsjy diff --git a/ccm-cms/src/test/resources/datasets/create_ccm_cms_schema.sql b/ccm-cms/src/test/resources/datasets/create_ccm_cms_schema.sql index 8faf1c5fd..a34bfaa07 100644 --- a/ccm-cms/src/test/resources/datasets/create_ccm_cms_schema.sql +++ b/ccm-cms/src/test/resources/datasets/create_ccm_cms_schema.sql @@ -1,17 +1,3 @@ -DROP SCHEMA IF EXISTS ccm_cms; -DROP SCHEMA IF EXISTS ccm_core; - -DROP SEQUENCE IF EXISTS hibernate_sequence; - -CREATE SCHEMA ccm_core; -CREATE SCHEMA ccm_cms; - - create table CCM_CMS.ARTICLE_LEADS ( - OBJECT_ID bigint not null, - LOCALIZED_VALUE longvarchar, - LOCALE varchar(255) not null, - primary key (OBJECT_ID, LOCALE) - ); create table CCM_CMS.ARTICLE_TEXTS ( OBJECT_ID bigint not null, @@ -109,7 +95,6 @@ CREATE SCHEMA ccm_cms; LIST_ORDER bigint, UUID varchar(255), ITEM_ID bigint, - CONTENT_ITEM_ID bigint, primary key (LIST_ID) ); @@ -355,15 +340,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID) ); - create table CCM_CMS.ContentItem_AttachmentList_AUD ( - REV integer not null, - CONTENT_ITEM_ID bigint not null, - LIST_ID bigint not null, - REVTYPE tinyint, - REVEND integer, - primary key (REV, CONTENT_ITEM_ID, LIST_ID) - ); - create table CCM_CMS.EVENT_COSTS ( OBJECT_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -844,15 +820,6 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.TASK_EVENT_URL_GENERATOR ( - GENERATOR_ID bigint not null, - EVENT varchar(256), - URL_GENERATOR_CLASS varchar(1024), - CONTENT_TYPE_ID bigint, - TASK_TYPE_ID bigint, - primary key (GENERATOR_ID) - ); - create table CCM_CMS.VIDEO_ASSETS ( HEIGHT bigint, WIDTH bigint, @@ -870,16 +837,9 @@ CREATE SCHEMA ccm_cms; primary key (OBJECT_ID, REV) ); - create table CCM_CMS.WORKFLOW_TASK_TYPES ( - TASK_TYPE_ID bigint not null, - DEFAULT_URL_GENERATOR_CLASS varchar(1024), - PRIVILEGE varchar(256), - primary key (TASK_TYPE_ID) - ); - create table CCM_CMS.WORKFLOW_TASKS ( + TASK_TYPE varchar(255), TASK_ID bigint not null, - TASK_TYPE_ID bigint, primary key (TASK_ID) ); @@ -1383,10 +1343,10 @@ CREATE SCHEMA ccm_cms; CONFIGURATION_CLASS varchar(512) not null, NAME varchar(512) not null, SETTING_VALUE_BIG_DECIMAL decimal(19,2), - SETTING_VALUE_STRING varchar(1024), - SETTING_VALUE_DOUBLE double, SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_LONG bigint, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_DOUBLE double, primary key (SETTING_ID) ); @@ -1407,13 +1367,6 @@ CREATE SCHEMA ccm_cms; value varchar(255) ); - create table CCM_CORE.TASK_ASSIGNMENTS ( - TASK_ASSIGNMENT_ID bigint not null, - ROLE_ID bigint, - TASK_ID bigint, - primary key (TASK_ASSIGNMENT_ID) - ); - create table CCM_CORE.THREADS ( OBJECT_ID bigint not null, ROOT_ID bigint, @@ -1440,6 +1393,17 @@ CREATE SCHEMA ccm_cms; primary key (PARTY_ID) ); + create table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS ( + DUE_DATE timestamp, + DURATION_MINUTES bigint, + LOCKED boolean, + START_DATE timestamp, + TASK_ID bigint not null, + LOCKING_USER_ID bigint, + NOTIFICATION_SENDER bigint, + primary key (TASK_ID) + ); + create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( WORKFLOW_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -1454,9 +1418,20 @@ CREATE SCHEMA ccm_cms; primary key (WORKFLOW_ID, LOCALE) ); + create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID bigint not null, + ROLE_ID bigint, + TASK_ID bigint, + primary key (TASK_ASSIGNMENT_ID) + ); + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( - TASK_ID bigint not null, - COMMENT clob + COMMENT_ID bigint not null, + COMMENT longvarchar, + UUID varchar(255) not null, + AUTHOR_ID bigint, + TASK_ID bigint, + primary key (COMMENT_ID) ); create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES ( @@ -1464,6 +1439,13 @@ CREATE SCHEMA ccm_cms; DEPENDENT_TASK_ID bigint not null ); + create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( + TASK_ID bigint not null, + LOCALIZED_VALUE longvarchar, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + create table CCM_CORE.WORKFLOW_TASK_LABELS ( TASK_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -1475,35 +1457,23 @@ CREATE SCHEMA ccm_cms; TASK_ID bigint not null, ACTIVE boolean, TASK_STATE varchar(512), + UUID varchar(255) not null, WORKFLOW_ID bigint, primary key (TASK_ID) ); - create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( - TASK_ID bigint not null, - LOCALIZED_VALUE longvarchar, - LOCALE varchar(255) not null, - primary key (TASK_ID, LOCALE) - ); - create table CCM_CORE.WORKFLOW_TEMPLATES ( WORKFLOW_ID bigint not null, primary key (WORKFLOW_ID) ); - create table CCM_CORE.WORKFLOW_USER_TASKS ( - DUE_DATE timestamp, - DURATION_MINUTES bigint, - LOCKED boolean, - START_DATE timestamp, - TASK_ID bigint not null, - LOCKING_USER_ID bigint, - NOTIFICATION_SENDER bigint, - primary key (TASK_ID) - ); - create table CCM_CORE.WORKFLOWS ( WORKFLOW_ID bigint not null, + ACTIVE boolean, + WORKFLOW_STATE varchar(255), + TASKS_STATE varchar(255), + UUID varchar(255) not null, + OBJECT_ID bigint, TEMPLATE_ID bigint, primary key (WORKFLOW_ID) ); @@ -1525,12 +1495,16 @@ CREATE SCHEMA ccm_cms; alter table CCM_CORE.SETTINGS add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); -create sequence hibernate_sequence start with 1 increment by 1; - alter table CCM_CMS.ARTICLE_LEADS - add constraint FK4g66u3qtfyepw0f733kuiiaul - foreign key (OBJECT_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + + alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); +create sequence hibernate_sequence start with 1 increment by 1; alter table CCM_CMS.ARTICLE_TEXTS add constraint FK1pel1j53h3t3adh9o5cbje2d3 @@ -1617,11 +1591,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (ITEM_ID) references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS - add constraint FK4c7jp8622b8m8nvdvdajnt0am - foreign key (CONTENT_ITEM_ID) - references CCM_CMS.CONTENT_ITEMS; - alter table CCM_CMS.ATTACHMENT_LISTS_AUD add constraint FKgdt5p8huh1lhk299hkrytqmqc foreign key (REV) @@ -1862,16 +1831,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (OBJECT_ID) references CCM_CORE.CCM_OBJECTS; - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK4notdhn18abev1asay7cmyy84 - foreign key (REV) - references CCM_CORE.CCM_REVISIONS; - - alter table CCM_CMS.ContentItem_AttachmentList_AUD - add constraint FK16sw895gdgghrymbirrgrvxsa - foreign key (REVEND) - references CCM_CORE.CCM_REVISIONS; - alter table CCM_CMS.EVENT_COSTS add constraint FKrbmepytotc73h5inefeih6rea foreign key (OBJECT_ID) @@ -2287,16 +2246,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (OBJECT_ID, REV) references CCM_CMS.ASSETS_AUD; - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKjjasedpc2ef91iknmiyqwhxrs - foreign key (CONTENT_TYPE_ID) - references CCM_CMS.CONTENT_TYPES; - - alter table CCM_CMS.TASK_EVENT_URL_GENERATOR - add constraint FKi3tnip5gr0i5hvw8skw21pveh - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - alter table CCM_CMS.VIDEO_ASSETS add constraint FKjuywvv7wq9pyid5b6ivyrc0yk foreign key (LEGAL_METADATA_ID) @@ -2313,14 +2262,9 @@ create sequence hibernate_sequence start with 1 increment by 1; references CCM_CMS.BINARY_ASSETS_AUD; alter table CCM_CMS.WORKFLOW_TASKS - add constraint FK1sk7ouwhx9r3buxvbfvfa7nnm - foreign key (TASK_TYPE_ID) - references CCM_CMS.WORKFLOW_TASK_TYPES; - - alter table CCM_CMS.WORKFLOW_TASKS - add constraint FKge2x94m1y9tr7mk26ensyn674 + add constraint FKoon3rwfmg0lhgbj4un4q3otya foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; alter table CCM_CORE.APPLICATIONS add constraint FKatcp9ij6mbkx0nfeig1o6n3lm @@ -2727,16 +2671,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (LIST_ID) references CCM_CORE.SETTINGS; - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKe29uwmvxdmol1fjob3auej4qv - foreign key (ROLE_ID) - references CCM_CORE.CCM_ROLES; - - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKc1vovbjg9mp5yegx2fdoutx7u - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_USER_TASKS; - alter table CCM_CORE.THREADS add constraint FKsx08mpwvwnw97uwdgjs76q39g foreign key (ROOT_ID) @@ -2757,6 +2691,21 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (PARTY_ID) references CCM_CORE.PARTIES; + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK1pnsq9ur3ylq0ghuj23p4cogs + foreign key (LOCKING_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FK9ngp088m8xa82swy7yg3qx6vh + foreign key (NOTIFICATION_SENDER) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint FKt9ha3no3bj8a50pnw8cnqh2cq + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_DESCRIPTIONS add constraint FKgx7upkqky82dpxvbs95imfl9l foreign key (WORKFLOW_ID) @@ -2767,6 +2716,21 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FKpq4paqtfbi5erhh98wl1ja005 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FK3933ol31co3yn5ee75b2hmhgp + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKd2ymdg8nay9pmh2nn2whba0j8 + foreign key (AUTHOR_ID) + references CCM_CORE.USERS; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS add constraint FKkfqrf9jdvm7livu5if06w0r5t foreign key (TASK_ID) @@ -2782,6 +2746,11 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (DEPENDS_ON_TASK_ID) references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint FKeb7mqbdx3bk7t01vo7kp2hpf + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_LABELS add constraint FKf715qud6g9xv2xeb8rrpnv4xs foreign key (TASK_ID) @@ -2792,30 +2761,15 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS - add constraint FK2s2498d2tpojjrtghq7iyaosv - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; - alter table CCM_CORE.WORKFLOW_TEMPLATES add constraint FK8692vdme4yxnkj1m0k1dw74pk foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKf09depwj5rgso2dair07vnu33 - foreign key (LOCKING_USER_ID) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FK6evo9y34awhdfcyl8gv78qb7f - foreign key (NOTIFICATION_SENDER) - references CCM_CORE.USERS; - - alter table CCM_CORE.WORKFLOW_USER_TASKS - add constraint FKefpdf9ojplu7loo31hfm0wl2h - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOWS + add constraint FKrm2yfrs6veoxoy304upq2wc64 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; alter table CCM_CORE.WORKFLOWS add constraint FKeixdxau4jebw682gd49tdbsjy diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-folder-in-other-section.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-folder-in-other-section.xml index 9291762a7..b0622eac8 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-folder-in-other-section.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-folder-in-other-section.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -774,15 +780,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-other-folder.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-other-folder.xml index 770ce7dc0..8e6027da1 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-other-folder.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-other-folder.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -775,15 +781,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-same-folder.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-same-folder.xml index 4754921df..2e35e64e7 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-same-folder.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-copy-to-same-folder.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -189,9 +195,9 @@ revtype="0" display_name="article1_copy1" /> + rev="8" + revtype="1" + display_name="sharedAsset" /> - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem-with-workflow.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem-with-workflow.xml index f3728356a..ba20afc56 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem-with-workflow.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem-with-workflow.xml @@ -1,10 +1,14 @@ - - - - + + + + @@ -53,18 +61,18 @@ localized_value="Task 2.1" locale="en" /> - - - - + + + + @@ -569,7 +577,7 @@ locale="en" localized_value="Curabitur vel sapien eu eros gravida bibendum vitae." /> - + - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem.xml index c931845c9..0805836e0 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem.xml @@ -1,10 +1,14 @@ - - - - + + + + - @@ -60,21 +69,21 @@ localized_value="Task 1.2" locale="en" /> - - - - - + + + + + @@ -721,15 +730,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move-to-other-section.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move-to-other-section.xml index 14dc8b7d2..7f2d28b28 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move-to-other-section.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move-to-other-section.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -138,8 +144,8 @@ display_name="projects_assets" uuid="8c4e9717-7cae-4f7d-bb25-f3aff793755e" /> + display_name="sharedAsset" + uuid="419a03e2-0415-4090-952d-cdc58e5e302c" /> @@ -650,15 +656,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move.xml index 35e8ac308..3ea4c5ecf 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-move.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -651,15 +657,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-publish.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-publish.xml index 77932ea4f..e72596ac9 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-publish.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-publish.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -775,15 +781,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-republish.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-republish.xml index 39bb891a2..f6ea47852 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-republish.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-republish.xml @@ -1,9 +1,12 @@ - - - + + + - @@ -43,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -708,15 +713,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-unpublish.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-unpublish.xml index 63f9d0547..e939f2766 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-unpublish.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/after-unpublish.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -170,9 +176,9 @@ rev="1" revtype="2" /> + rev="0" + revtype="0" + display_name="sharedAsset" /> - + - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml index adaecaecf..26eb21b36 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml @@ -1,9 +1,12 @@ - - - + + + @@ -42,15 +48,15 @@ localized_value="Task 2.1" locale="en" /> - - - + + + @@ -650,15 +656,15 @@ - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-contenttype.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-contenttype.xml index 7a5339754..77a690d44 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-contenttype.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-contenttype.xml @@ -103,10 +103,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="info" /> - - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-role.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-role.xml index 90242f0ac..831b5f190 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-role.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-add-role.xml @@ -65,9 +65,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="info" /> - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-create.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-create.xml index 221adce07..b71af127d 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-create.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-create.xml @@ -105,10 +105,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="test" /> - - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-contenttype.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-contenttype.xml index 8534b4dae..db22f5b61 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-contenttype.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-contenttype.xml @@ -97,9 +97,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="info" /> - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml index 2dfa7b9c2..abda6c17b 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml @@ -100,9 +100,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="info" /> - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml index 9c9572c7d..5b6d36de2 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml @@ -66,9 +66,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="content" /> - - - + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/data.xml b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/data.xml index 5a893922c..ee8f76e1e 100644 --- a/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/data.xml +++ b/ccm-cms/src/test/resources/datasets/org/librecms/contentsection/ContentSectionManagerTest/data.xml @@ -100,9 +100,12 @@ application_type="org.librecms.contentsection.ContentSection" primary_url="info" /> - - - + + + diff --git a/ccm-core/src/main/java/org/libreccm/workflow/Task.java b/ccm-core/src/main/java/org/libreccm/workflow/Task.java index 096cbe136..58cf6e8ff 100644 --- a/ccm-core/src/main/java/org/libreccm/workflow/Task.java +++ b/ccm-core/src/main/java/org/libreccm/workflow/Task.java @@ -133,7 +133,7 @@ public class Task implements Identifiable, Serializable { @Embedded @AssociationOverride( name = "values", - joinTable = @JoinTable(name = "WORKFLOW_TASKS_DESCRIPTIONS", + joinTable = @JoinTable(name = "WORKFLOW_TASK_DESCRIPTIONS", schema = DB_SCHEMA, joinColumns = { @JoinColumn(name = "TASK_ID")})) diff --git a/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignment.java b/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignment.java index ed61d3720..7ebbdebd6 100644 --- a/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignment.java +++ b/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignment.java @@ -40,7 +40,7 @@ import javax.persistence.Table; * @author Jens Pelzetter */ @Entity -@Table(name = "TASK_ASSIGNMENTS", schema = DB_SCHEMA) +@Table(name = "WORKFLOW_TASK_ASSIGNMENTS", schema = DB_SCHEMA) public class TaskAssignment implements Serializable { private static final long serialVersionUID = -4427537363301565707L; diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_9__workflow.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_9__workflow.sql new file mode 100644 index 000000000..1eed46b0a --- /dev/null +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_9__workflow.sql @@ -0,0 +1,88 @@ +alter table CCM_CORE.WORKFLOWS + add column ACTIVE boolean; + +alter table CCM_CORE.WORKFLOWS + add column WORKFLOW_STATE character varying(255); + +alter table CCM_CORE.WORKFLoWS + add column TASKS_STATE character varying(255); + +alter table CCM_CORE.WORKFLOWS + add column UUID character varying(255) not null; + +alter table CCM_CORE.WORKFLOWS + add column object_id int8; + +alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); + +alter table CCM_CORE.WORKFLOWS + add constraint fkrm2yfrs6veoxoy304upq2wc64 + foreign key(object_id) + references CCM_CORE.CCM_OBJECTS; + +alter table CCM_CORE.WORKFLOW_TASKS + add column UUID character varying(255) not null; + +alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + +alter table CCM_CORE.WORKFLOW_TASK_LABELS + add constraint fkf715qud6g9xv2xeb8rrpnv4x + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS + rename to WORKFLOW_TASK_DESCRIPTIONS; + +alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint fkf715qud6g9xv2xeb8rrpnv4xs + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES + add constraint fk1htp420ki24jaswtcum56iawe + foreign key (DEPENDENT_TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES + add constraint fk8rbggnp4yjpab8quvvx800ymy + foreign key (DEPENDS_ON_TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +drop table CCM_CORE.WORKFLOW_TASK_COMMENTS; + +create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( + COMMENT_ID int8 not null, + COMMENT text, + UUID varchar(255) not null, + AUTHOR_ID int8, + TASK_ID int8, + primary key (COMMENT_ID) +); + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKd2ymdg8nay9pmh2nn2whba0j8 + foreign key (AUTHOR_ID) + references CCM_CORE.USERS; + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKkfqrf9jdvm7livu5if06w0r5t + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_USER_TASKS + rename to WORKFLOW_ASSIGNABLE_TASKS; + +alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint fkt9ha3no3bj8a50pnw8cnqh2cq + foreign key(TASK_ID) + references CCM_CORE.WORKFLOW_TASKS(TASK_ID); + +alter table CCM_CORE.TASK_ASSIGNMENTS + rename to WORKFLOW_TASK_ASSIGNMENTS; + + diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_9__workflow.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_9__workflow.sql new file mode 100644 index 000000000..0e80dbad2 --- /dev/null +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_9__workflow.sql @@ -0,0 +1,87 @@ +alter table CCM_CORE.WORKFLOWS + add column ACTIVE boolean; + +alter table CCM_CORE.WORKFLOWS + add column WORKFLOW_STATE character varying(255); + +alter table CCM_CORE.WORKFLoWS + add column TASKS_STATE character varying(255); + +alter table CCM_CORE.WORKFLOWS + add column UUID character varying(255) not null; + +alter table CCM_CORE.WORKFLOWS + add column object_id bigint; + +alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); + +alter table CCM_CORE.WORKFLOWS + add constraint fkrm2yfrs6veoxoy304upq2wc64 + foreign key(object_id) + references CCM_CORE.CCM_OBJECTS; + +alter table CCM_CORE.WORKFLOW_TASKS + add column UUID character varying(255) not null; + +alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + +alter table CCM_CORE.WORKFLOW_TASK_LABELS + add constraint fkf715qud6g9xv2xeb8rrpnv4x + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS + rename to WORKFLOW_TASK_DESCRIPTIONS; + +alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint fkf715qud6g9xv2xeb8rrpnv4xs + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES + add constraint fk1htp420ki24jaswtcum56iawe + foreign key (DEPENDENT_TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES + add constraint fk8rbggnp4yjpab8quvvx800ymy + foreign key (DEPENDS_ON_TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +drop table CCM_CORE.WORKFLOW_TASK_COMMENTS; + +create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( + COMMENT_ID int8 not null, + COMMENT text, + UUID varchar(255) not null, + AUTHOR_ID int8, + TASK_ID int8, + primary key (COMMENT_ID) +); + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKd2ymdg8nay9pmh2nn2whba0j8 + foreign key (AUTHOR_ID) + references CCM_CORE.USERS; + +alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint FKkfqrf9jdvm7livu5if06w0r5t + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + +alter table CCM_CORE.WORKFLOW_USER_TASKS + rename to WORKFLOW_ASSIGNABLE_TASKS; + +alter table CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS + add constraint fkt9ha3no3bj8a50pnw8cnqh2cq + foreign key(TASK_ID) + references CCM_CORE.WORKFLOW_TASKS(TASK_ID); + +alter table CCM_CORE.TASK_ASSIGNMENTS + rename to WORKFLOW_TASK_ASSIGNMENTS; + diff --git a/ccm-core/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_core_schema.sql b/ccm-core/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_core_schema.sql index 8f62fd7ed..bec469212 100644 --- a/ccm-core/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_core_schema.sql +++ b/ccm-core/src/test/resources-wildfly-remote-h2-mem/scripts/create_ccm_core_schema.sql @@ -492,11 +492,11 @@ SETTING_ID bigint not null, CONFIGURATION_CLASS varchar(512) not null, NAME varchar(512) not null, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_LONG bigint, SETTING_VALUE_DOUBLE double, SETTING_VALUE_BOOLEAN boolean, - SETTING_VALUE_LONG bigint, SETTING_VALUE_BIG_DECIMAL decimal(19,2), - SETTING_VALUE_STRING varchar(1024), primary key (SETTING_ID) ); @@ -517,13 +517,6 @@ value varchar(255) ); - create table CCM_CORE.TASK_ASSIGNMENTS ( - TASK_ASSIGNMENT_ID bigint not null, - ROLE_ID bigint, - TASK_ID bigint, - primary key (TASK_ASSIGNMENT_ID) - ); - create table CCM_CORE.THREADS ( OBJECT_ID bigint not null, ROOT_ID bigint, @@ -575,9 +568,17 @@ primary key (WORKFLOW_ID, LOCALE) ); + create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID bigint not null, + ROLE_ID bigint, + TASK_ID bigint, + primary key (TASK_ASSIGNMENT_ID) + ); + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( COMMENT_ID bigint not null, COMMENT longvarchar, + UUID varchar(255) not null, AUTHOR_ID bigint, TASK_ID bigint, primary key (COMMENT_ID) @@ -588,6 +589,13 @@ DEPENDENT_TASK_ID bigint not null ); + create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( + TASK_ID bigint not null, + LOCALIZED_VALUE longvarchar, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + create table CCM_CORE.WORKFLOW_TASK_LABELS ( TASK_ID bigint not null, LOCALIZED_VALUE longvarchar, @@ -599,17 +607,11 @@ TASK_ID bigint not null, ACTIVE boolean, TASK_STATE varchar(512), + UUID varchar(255) not null, WORKFLOW_ID bigint, primary key (TASK_ID) ); - create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( - TASK_ID bigint not null, - LOCALIZED_VALUE longvarchar, - LOCALE varchar(255) not null, - primary key (TASK_ID, LOCALE) - ); - create table CCM_CORE.WORKFLOW_TEMPLATES ( WORKFLOW_ID bigint not null, primary key (WORKFLOW_ID) @@ -619,6 +621,8 @@ WORKFLOW_ID bigint not null, ACTIVE boolean, WORKFLOW_STATE varchar(255), + TASKS_STATE varchar(255), + UUID varchar(255) not null, OBJECT_ID bigint, TEMPLATE_ID bigint, primary key (WORKFLOW_ID) @@ -641,6 +645,15 @@ alter table CCM_CORE.SETTINGS add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); + + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + + alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); create sequence hibernate_sequence start with 1 increment by 1; alter table CCM_CORE.APPLICATIONS @@ -1048,16 +1061,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (LIST_ID) references CCM_CORE.SETTINGS; - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKe29uwmvxdmol1fjob3auej4qv - foreign key (ROLE_ID) - references CCM_CORE.CCM_ROLES; - - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKk6gl2yvqr7gnqq25s1bm2gy4i - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; - alter table CCM_CORE.THREADS add constraint FKsx08mpwvwnw97uwdgjs76q39g foreign key (ROOT_ID) @@ -1103,6 +1106,16 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FKpq4paqtfbi5erhh98wl1ja005 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FK3933ol31co3yn5ee75b2hmhgp + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS add constraint FKd2ymdg8nay9pmh2nn2whba0j8 foreign key (AUTHOR_ID) @@ -1123,6 +1136,11 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (DEPENDS_ON_TASK_ID) references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint FKeb7mqbdx3bk7t01vo7kp2hpf + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_LABELS add constraint FKf715qud6g9xv2xeb8rrpnv4xs foreign key (TASK_ID) @@ -1133,11 +1151,6 @@ create sequence hibernate_sequence start with 1 increment by 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS - add constraint FK2s2498d2tpojjrtghq7iyaosv - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; - alter table CCM_CORE.WORKFLOW_TEMPLATES add constraint FK8692vdme4yxnkj1m0k1dw74pk foreign key (WORKFLOW_ID) diff --git a/ccm-core/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_core_schema.sql b/ccm-core/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_core_schema.sql index 6d9690644..1cb060b4d 100644 --- a/ccm-core/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_core_schema.sql +++ b/ccm-core/src/test/resources-wildfly-remote-pgsql/scripts/create_ccm_core_schema.sql @@ -492,11 +492,11 @@ SETTING_ID int8 not null, CONFIGURATION_CLASS varchar(512) not null, NAME varchar(512) not null, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_LONG int8, SETTING_VALUE_DOUBLE float8, SETTING_VALUE_BOOLEAN boolean, - SETTING_VALUE_LONG int8, SETTING_VALUE_BIG_DECIMAL numeric(19, 2), - SETTING_VALUE_STRING varchar(1024), primary key (SETTING_ID) ); @@ -517,13 +517,6 @@ value varchar(255) ); - create table CCM_CORE.TASK_ASSIGNMENTS ( - TASK_ASSIGNMENT_ID int8 not null, - ROLE_ID int8, - TASK_ID int8, - primary key (TASK_ASSIGNMENT_ID) - ); - create table CCM_CORE.THREADS ( OBJECT_ID int8 not null, ROOT_ID int8, @@ -575,9 +568,17 @@ primary key (WORKFLOW_ID, LOCALE) ); + create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID int8 not null, + ROLE_ID int8, + TASK_ID int8, + primary key (TASK_ASSIGNMENT_ID) + ); + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( COMMENT_ID int8 not null, COMMENT text, + UUID varchar(255) not null, AUTHOR_ID int8, TASK_ID int8, primary key (COMMENT_ID) @@ -588,6 +589,13 @@ DEPENDENT_TASK_ID int8 not null ); + create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( + TASK_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + create table CCM_CORE.WORKFLOW_TASK_LABELS ( TASK_ID int8 not null, LOCALIZED_VALUE text, @@ -599,17 +607,11 @@ TASK_ID int8 not null, ACTIVE boolean, TASK_STATE varchar(512), + UUID varchar(255) not null, WORKFLOW_ID int8, primary key (TASK_ID) ); - create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( - TASK_ID int8 not null, - LOCALIZED_VALUE text, - LOCALE varchar(255) not null, - primary key (TASK_ID, LOCALE) - ); - create table CCM_CORE.WORKFLOW_TEMPLATES ( WORKFLOW_ID int8 not null, primary key (WORKFLOW_ID) @@ -619,6 +621,8 @@ WORKFLOW_ID int8 not null, ACTIVE boolean, WORKFLOW_STATE varchar(255), + TASKS_STATE varchar(255), + UUID varchar(255) not null, OBJECT_ID int8, TEMPLATE_ID int8, primary key (WORKFLOW_ID) @@ -641,6 +645,15 @@ alter table CCM_CORE.SETTINGS add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); + + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS + add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID); + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID); + + alter table CCM_CORE.WORKFLOWS + add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); create sequence hibernate_sequence start 1 increment 1; alter table CCM_CORE.APPLICATIONS @@ -1048,16 +1061,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (LIST_ID) references CCM_CORE.SETTINGS; - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKe29uwmvxdmol1fjob3auej4qv - foreign key (ROLE_ID) - references CCM_CORE.CCM_ROLES; - - alter table CCM_CORE.TASK_ASSIGNMENTS - add constraint FKk6gl2yvqr7gnqq25s1bm2gy4i - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; - alter table CCM_CORE.THREADS add constraint FKsx08mpwvwnw97uwdgjs76q39g foreign key (ROOT_ID) @@ -1103,6 +1106,16 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FKpq4paqtfbi5erhh98wl1ja005 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS + add constraint FK3933ol31co3yn5ee75b2hmhgp + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_ASSIGNABLE_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_COMMENTS add constraint FKd2ymdg8nay9pmh2nn2whba0j8 foreign key (AUTHOR_ID) @@ -1123,6 +1136,11 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (DEPENDS_ON_TASK_ID) references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS + add constraint FKeb7mqbdx3bk7t01vo7kp2hpf + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_TASKS; + alter table CCM_CORE.WORKFLOW_TASK_LABELS add constraint FKf715qud6g9xv2xeb8rrpnv4xs foreign key (TASK_ID) @@ -1133,11 +1151,6 @@ create sequence hibernate_sequence start 1 increment 1; foreign key (WORKFLOW_ID) references CCM_CORE.WORKFLOWS; - alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS - add constraint FK2s2498d2tpojjrtghq7iyaosv - foreign key (TASK_ID) - references CCM_CORE.WORKFLOW_TASKS; - alter table CCM_CORE.WORKFLOW_TEMPLATES add constraint FK8692vdme4yxnkj1m0k1dw74pk foreign key (WORKFLOW_ID)