diff --git a/install/create_tables-innodb.sql b/install/create_tables-innodb.sql index 245b62487..3994dba1f 100644 --- a/install/create_tables-innodb.sql +++ b/install/create_tables-innodb.sql @@ -811,22 +811,18 @@ CREATE TABLE `tblWorkflowTransitionGroups` ( CREATE TABLE `tblWorkflowLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `document` int(11) DEFAULT NULL, - `version` smallint(5) DEFAULT NULL, - `workflow` int(11) DEFAULT NULL, + `workflowdocumentcontent` int(11) NOT NULL DEFAULT '0', `userid` int(11) DEFAULT NULL, `transition` int(11) DEFAULT NULL, `date` datetime NOT NULL, `comment` text, PRIMARY KEY (`id`), - KEY `tblWorkflowLog_document` (`document`), - KEY `tblWorkflowLog_workflow` (`workflow`), KEY `tblWorkflowLog_userid` (`userid`), KEY `tblWorkflowLog_transition` (`transition`), - CONSTRAINT `tblWorkflowLog_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE, + KEY `tblWorkflowLog_workflowdocumentcontent` (`workflowdocumentcontent`), + CONSTRAINT `tblWorkflowLog_workflowdocumentcontent` FOREIGN KEY (`workflowdocumentcontent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE, CONSTRAINT `tblWorkflowLog_transition` FOREIGN KEY (`transition`) REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE, - CONSTRAINT `tblWorkflowLog_userid` FOREIGN KEY (`userid`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE, - CONSTRAINT `tblWorkflowLog_workflow` FOREIGN KEY (`workflow`) REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE + CONSTRAINT `tblWorkflowLog_userid` FOREIGN KEY (`userid`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -836,7 +832,8 @@ CREATE TABLE `tblWorkflowLog` ( -- CREATE TABLE `tblWorkflowDocumentContent` ( - `parentworkflow` int(11) DEFAULT '0', + `id` int(11) NOT NULL AUTO_INCREMENT, + `parent` int(11) DEFAULT NULL, `workflow` int(11) DEFAULT NULL, `document` int(11) DEFAULT NULL, `version` smallint(5) DEFAULT NULL, @@ -847,6 +844,7 @@ CREATE TABLE `tblWorkflowDocumentContent` ( KEY `tblWorkflowDocument_state` (`state`), CONSTRAINT `tblWorkflowDocument_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE, CONSTRAINT `tblWorkflowDocument_state` FOREIGN KEY (`state`) REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE, + CONSTRAINT `tblWorkflowDocumentContent_parent` FOREIGN KEY (`parent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE, CONSTRAINT `tblWorkflowDocument_workflow` FOREIGN KEY (`workflow`) REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/install/create_tables-postgres.sql b/install/create_tables-postgres.sql index 7a36a63b2..a1150b0fa 100644 --- a/install/create_tables-postgres.sql +++ b/install/create_tables-postgres.sql @@ -536,7 +536,7 @@ CREATE TABLE "tblSessions" ( "theme" varchar(30) NOT NULL default '', "language" varchar(30) NOT NULL default '', "clipboard" text default NULL, - "su" INTEGER DEFAULT NULL, + "su" INTEGER DEFAULT NULL, "splashmsg" text default NULL ) ; @@ -669,9 +669,7 @@ CREATE TABLE "tblWorkflowTransitionGroups" ( CREATE TABLE "tblWorkflowLog" ( "id" SERIAL UNIQUE, - "document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, - "version" INTEGER default NULL, - "workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, + "workflowdocumentcontent" INTEGER DEFAULT NULL REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE, "userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE, "transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE, "date" TIMESTAMP default NULL, @@ -685,7 +683,8 @@ CREATE TABLE "tblWorkflowLog" ( -- CREATE TABLE "tblWorkflowDocumentContent" ( - "parentworkflow" INTEGER DEFAULT 0, + "id" SERIAL UNIQUE, + "parent" INTEGER DEFAULT NULL REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE, "workflow" INTEGER DEFAULT NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE, "document" INTEGER DEFAULT NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE, "version" INTEGER DEFAULT NULL, diff --git a/install/create_tables-sqlite3.sql b/install/create_tables-sqlite3.sql index 15e471de0..15bddbb78 100644 --- a/install/create_tables-sqlite3.sql +++ b/install/create_tables-sqlite3.sql @@ -545,7 +545,7 @@ CREATE TABLE `tblSessions` ( `theme` varchar(30) NOT NULL default '', `language` varchar(30) NOT NULL default '', `clipboard` text default NULL, - `su` INTEGER DEFAULT NULL, + `su` INTEGER DEFAULT NULL, `splashmsg` text default NULL ) ; @@ -678,9 +678,7 @@ CREATE TABLE `tblWorkflowTransitionGroups` ( CREATE TABLE `tblWorkflowLog` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT, - `document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE, - `version` INTEGER default NULL, - `workflow` INTEGER default NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE, + `workflowdocumentcontent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE, `userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE, `transition` INTEGER default NULL REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE, `date` datetime NOT NULL, @@ -694,7 +692,9 @@ CREATE TABLE `tblWorkflowLog` ( -- CREATE TABLE `tblWorkflowDocumentContent` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT, `parentworkflow` INTEGER DEFAULT 0, + `parent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE, `workflow` INTEGER DEFAULT NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE, `document` INTEGER DEFAULT NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE, `version` INTEGER DEFAULT NULL,