2017-02-13 19:09:43 +00:00
|
|
|
--
|
|
|
|
-- Table structure for table "tblACLs"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblACLs" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"target" INTEGER NOT NULL default '0',
|
|
|
|
"targetType" INTEGER NOT NULL default '0',
|
|
|
|
"userID" INTEGER NOT NULL default '-1',
|
|
|
|
"groupID" INTEGER NOT NULL default '-1',
|
|
|
|
"mode" INTEGER NOT NULL default '0'
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblCategory"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblCategory" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" text NOT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblAttributeDefinitions"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblAttributeDefinitions" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(100) default NULL,
|
|
|
|
"objtype" INTEGER NOT NULL default '0',
|
|
|
|
"type" INTEGER NOT NULL default '0',
|
|
|
|
"multiple" INTEGER NOT NULL default '0',
|
|
|
|
"minvalues" INTEGER NOT NULL default '0',
|
|
|
|
"maxvalues" INTEGER NOT NULL default '0',
|
|
|
|
"valueset" TEXT default NULL,
|
|
|
|
"regex" TEXT DEFAULT NULL,
|
|
|
|
UNIQUE("name")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
2020-06-16 05:20:57 +00:00
|
|
|
-- Table structure for table `tblRoles`
|
2017-02-13 21:05:15 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblRoles" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(50) default NULL,
|
|
|
|
"role" INTEGER NOT NULL default '0',
|
|
|
|
"noaccess" varchar(30) NOT NULL default ''
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
2017-02-13 19:09:43 +00:00
|
|
|
-- Table structure for table "tblUsers"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblUsers" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"login" varchar(50) default NULL,
|
|
|
|
"pwd" varchar(50) default NULL,
|
2017-02-13 21:05:15 +00:00
|
|
|
"secret" varchar(50) default NULL,
|
2017-02-13 19:09:43 +00:00
|
|
|
"fullName" varchar(100) default NULL,
|
|
|
|
"email" varchar(70) default NULL,
|
|
|
|
"language" varchar(32) NOT NULL,
|
|
|
|
"theme" varchar(32) NOT NULL,
|
|
|
|
"comment" text NOT NULL,
|
|
|
|
"role" INTEGER NOT NULL default '0',
|
|
|
|
"hidden" INTEGER NOT NULL default '0',
|
|
|
|
"pwdExpiration" TIMESTAMP default NULL,
|
|
|
|
"loginfailures" INTEGER NOT NULL default '0',
|
|
|
|
"disabled" INTEGER NOT NULL default '0',
|
2017-02-20 13:56:25 +00:00
|
|
|
"quota" BIGINT,
|
2017-02-13 19:09:43 +00:00
|
|
|
"homefolder" INTEGER default NULL,
|
|
|
|
UNIQUE ("login")
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
2017-02-13 21:05:15 +00:00
|
|
|
-- Table structure for table `tblUserSubstitutes`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblUserSubstitutes" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"user" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"substitute" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
2017-02-13 19:09:43 +00:00
|
|
|
-- Table structure for table "tblUserPasswordRequest"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblUserPasswordRequest" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" (id) ON DELETE CASCADE,
|
|
|
|
"hash" varchar(50) default NULL,
|
|
|
|
"date" TIMESTAMP default NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblUserPasswordHistory"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblUserPasswordHistory" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"pwd" varchar(50) default NULL,
|
|
|
|
"date" TIMESTAMP default NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblUserImages"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblUserImages" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"image" TEXT NOT NULL,
|
2017-02-20 13:56:25 +00:00
|
|
|
"mimeType" varchar(100) NOT NULL default ''
|
2017-02-13 19:09:43 +00:00
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblFolders"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblFolders" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(70) default NULL,
|
|
|
|
"parent" INTEGER default NULL,
|
|
|
|
"folderList" text NOT NULL,
|
|
|
|
"comment" text,
|
|
|
|
"date" INTEGER default NULL,
|
|
|
|
"owner" INTEGER default NULL REFERENCES "tblUsers" ("id"),
|
|
|
|
"inheritAccess" INTEGER NOT NULL default '1',
|
|
|
|
"defaultAccess" INTEGER NOT NULL default '0',
|
|
|
|
"sequence" REAL NOT NULL default '0'
|
|
|
|
) ;
|
|
|
|
|
|
|
|
ALTER TABLE "tblUsers" ADD FOREIGN KEY("homefolder") REFERENCES "tblFolders"("id");
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblFolderAttributes"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblFolderAttributes" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"folder" INTEGER default NULL REFERENCES "tblFolders" ("id") ON DELETE CASCADE,
|
|
|
|
"attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"),
|
|
|
|
"value" text default NULL,
|
|
|
|
UNIQUE (folder, attrdef)
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocuments"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocuments" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(150) default NULL,
|
|
|
|
"comment" text,
|
|
|
|
"date" INTEGER default NULL,
|
|
|
|
"expires" INTEGER default NULL,
|
|
|
|
"owner" INTEGER default NULL REFERENCES "tblUsers" ("id"),
|
|
|
|
"folder" INTEGER default NULL REFERENCES "tblFolders" ("id"),
|
|
|
|
"folderList" text NOT NULL,
|
|
|
|
"inheritAccess" INTEGER NOT NULL default '1',
|
|
|
|
"defaultAccess" INTEGER NOT NULL default '0',
|
|
|
|
"locked" INTEGER NOT NULL default '-1',
|
|
|
|
"keywords" text NOT NULL,
|
|
|
|
"sequence" REAL NOT NULL default '0'
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentAttributes"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentAttributes" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"),
|
|
|
|
"value" text default NULL,
|
|
|
|
UNIQUE (document, attrdef)
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentApprovers"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentApprovers" (
|
|
|
|
"approveID" SERIAL UNIQUE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"type" INTEGER NOT NULL default '0',
|
|
|
|
"required" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("documentID","version","type","required")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentApproveLog"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentApproveLog" (
|
|
|
|
"approveLogID" SERIAL UNIQUE,
|
|
|
|
"approveID" INTEGER NOT NULL default '0' REFERENCES "tblDocumentApprovers" ("approveID") ON DELETE CASCADE,
|
|
|
|
"status" INTEGER NOT NULL default '0',
|
|
|
|
"comment" TEXT NOT NULL,
|
|
|
|
"date" TIMESTAMP default NULL,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentContent"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentContent" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"document" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id"),
|
|
|
|
"version" INTEGER NOT NULL,
|
|
|
|
"comment" text,
|
|
|
|
"date" INTEGER default NULL,
|
|
|
|
"createdBy" INTEGER default NULL,
|
|
|
|
"dir" varchar(255) NOT NULL default '',
|
|
|
|
"orgFileName" varchar(150) NOT NULL default '',
|
|
|
|
"fileType" varchar(10) NOT NULL default '',
|
2017-02-16 14:24:49 +00:00
|
|
|
"mimeType" varchar(100) NOT NULL default '',
|
2017-02-20 10:55:26 +00:00
|
|
|
"fileSize" BIGINT,
|
2017-02-13 19:09:43 +00:00
|
|
|
"checksum" char(32),
|
2017-02-13 21:05:15 +00:00
|
|
|
"revisiondate" TIMESTAMP default NULL,
|
2017-02-13 19:09:43 +00:00
|
|
|
UNIQUE ("document","version")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentContentAttributes"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentContentAttributes" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"content" INTEGER default NULL REFERENCES "tblDocumentContent" ("id") ON DELETE CASCADE,
|
|
|
|
"attrdef" INTEGER default NULL REFERENCES "tblAttributeDefinitions" ("id"),
|
|
|
|
"value" text default NULL,
|
|
|
|
UNIQUE (content, attrdef)
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentLinks"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentLinks" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"document" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"target" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id"),
|
|
|
|
"public" INTEGER NOT NULL default 0
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentFiles"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentFiles" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"document" INTEGER NOT NULL default 0 REFERENCES "tblDocuments" ("id"),
|
|
|
|
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id"),
|
2017-02-20 14:41:44 +00:00
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"public" INTEGER NOT NULL default '0',
|
2017-02-13 19:09:43 +00:00
|
|
|
"comment" text,
|
|
|
|
"name" varchar(150) default NULL,
|
|
|
|
"date" INTEGER default NULL,
|
|
|
|
"dir" varchar(255) NOT NULL default '',
|
|
|
|
"orgFileName" varchar(150) NOT NULL default '',
|
|
|
|
"fileType" varchar(10) NOT NULL default '',
|
2017-02-16 14:24:49 +00:00
|
|
|
"mimeType" varchar(100) NOT NULL default ''
|
2017-02-13 19:09:43 +00:00
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentLocks"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentLocks" (
|
|
|
|
"document" INTEGER REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 21:05:15 +00:00
|
|
|
--
|
|
|
|
-- Table structure for table `tblDocumentCheckOuts`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentCheckOuts" (
|
|
|
|
"document" INTEGER REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id"),
|
|
|
|
"date" TEXT NOT NULL,
|
|
|
|
"filename" varchar(255) NOT NULL default '',
|
|
|
|
UNIQUE ("document")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentReviewers"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentReviewers" (
|
|
|
|
"reviewID" SERIAL UNIQUE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"type" INTEGER NOT NULL default '0',
|
|
|
|
"required" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("documentID","version","type","required")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentReviewLog"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentReviewLog" (
|
|
|
|
"reviewLogID" SERIAL UNIQUE,
|
|
|
|
"reviewID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentReviewers" ("reviewID") ON DELETE CASCADE,
|
|
|
|
"status" INTEGER NOT NULL default 0,
|
|
|
|
"comment" TEXT NOT NULL,
|
|
|
|
"date" TIMESTAMP NOT NULL,
|
|
|
|
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 21:05:15 +00:00
|
|
|
--
|
|
|
|
-- Table structure for table `tblDocumentRecipients`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentRecipients" (
|
|
|
|
"receiptID" SERIAL UNIQUE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"type" INTEGER NOT NULL default '0',
|
|
|
|
"required" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("documentID","version","type","required")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentReceiptLog"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentReceiptLog" (
|
|
|
|
"receiptLogID" SERIAL UNIQUE,
|
|
|
|
"receiptID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRecipients" ("receiptID") ON DELETE CASCADE,
|
|
|
|
"status" INTEGER NOT NULL default 0,
|
|
|
|
"comment" TEXT NOT NULL,
|
|
|
|
"date" TEXT NOT NULL,
|
|
|
|
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table `tblDocumentRevisors`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentRevisors" (
|
|
|
|
"revisionID" SERIAL UNIQUE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"type" INTEGER NOT NULL default '0',
|
|
|
|
"required" INTEGER NOT NULL default '0',
|
|
|
|
"startdate" TIMESTAMP default NULL,
|
|
|
|
UNIQUE ("documentID","version","type","required")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentRevisionLog"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentRevisionLog" (
|
|
|
|
"revisionLogID" SERIAL UNIQUE,
|
|
|
|
"revisionID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRevisors" ("revisionID") ON DELETE CASCADE,
|
|
|
|
"status" INTEGER NOT NULL default 0,
|
|
|
|
"comment" TEXT NOT NULL,
|
|
|
|
"date" TIMESTAMP default NULL,
|
|
|
|
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentStatus"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentStatus" (
|
|
|
|
"statusID" SERIAL UNIQUE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("documentID","version")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentStatusLog"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentStatusLog" (
|
|
|
|
"statusLogID" SERIAL UNIQUE,
|
|
|
|
"statusID" INTEGER NOT NULL default '0' REFERENCES "tblDocumentStatus" ("statusID") ON DELETE CASCADE,
|
|
|
|
"status" INTEGER NOT NULL default '0',
|
|
|
|
"comment" text NOT NULL,
|
|
|
|
"date" TIMESTAMP default NULL,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblGroups"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblGroups" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(50) default NULL,
|
|
|
|
"comment" text NOT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblGroupMembers"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblGroupMembers" (
|
|
|
|
"groupID" INTEGER NOT NULL default '0' REFERENCES "tblGroups" ("id") ON DELETE CASCADE,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"manager" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("groupID","userID")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblKeywordCategories"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblKeywordCategories" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(255) NOT NULL default '',
|
|
|
|
"owner" INTEGER NOT NULL default '0'
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblKeywords"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblKeywords" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"category" INTEGER NOT NULL default '0' REFERENCES "tblKeywordCategories" ("id") ON DELETE CASCADE,
|
|
|
|
"keywords" text NOT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblDocumentCategory"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblDocumentCategory" (
|
|
|
|
"categoryID" INTEGER NOT NULL default '0' REFERENCES "tblCategory" ("id") ON DELETE CASCADE,
|
|
|
|
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblNotify"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblNotify" (
|
|
|
|
"target" INTEGER NOT NULL default '0',
|
|
|
|
"targetType" INTEGER NOT NULL default '0',
|
|
|
|
"userID" INTEGER NOT NULL default '-1',
|
|
|
|
"groupID" INTEGER NOT NULL default '-1',
|
|
|
|
UNIQUE ("target","targetType","userID","groupID")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table "tblSessions"
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblSessions" (
|
|
|
|
"id" varchar(50) PRIMARY KEY,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"lastAccess" INTEGER NOT NULL default '0',
|
|
|
|
"theme" varchar(30) NOT NULL default '',
|
|
|
|
"language" varchar(30) NOT NULL default '',
|
|
|
|
"clipboard" text default NULL,
|
2018-04-04 15:07:25 +00:00
|
|
|
"su" INTEGER DEFAULT NULL,
|
2017-02-13 19:09:43 +00:00
|
|
|
"splashmsg" text default NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for mandatory reviewers
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblMandatoryReviewers" (
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"reviewerUserID" INTEGER NOT NULL default '0',
|
|
|
|
"reviewerGroupID" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("userID","reviewerUserID","reviewerGroupID")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for mandatory approvers
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblMandatoryApprovers" (
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"approverUserID" INTEGER NOT NULL default '0',
|
|
|
|
"approverGroupID" INTEGER NOT NULL default '0',
|
|
|
|
UNIQUE ("userID","approverUserID","approverGroupID")
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for events (calendar)
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblEvents" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(150) default NULL,
|
|
|
|
"comment" text,
|
|
|
|
"start" INTEGER default NULL,
|
|
|
|
"stop" INTEGER default NULL,
|
|
|
|
"date" INTEGER default NULL,
|
|
|
|
"userID" INTEGER NOT NULL default '0'
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow states
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowStates" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" text NOT NULL,
|
|
|
|
"visibility" INTEGER DEFAULT 0,
|
|
|
|
"maxtime" INTEGER DEFAULT 0,
|
|
|
|
"precondfunc" text DEFAULT NULL,
|
|
|
|
"documentstatus" INTEGER DEFAULT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow actions
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowActions" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" text NOT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflows
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflows" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" text NOT NULL,
|
2017-02-13 21:05:15 +00:00
|
|
|
"initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
|
|
|
|
"layoutdata" text default NULL
|
2017-02-13 19:09:43 +00:00
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow transitions
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowTransitions" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
|
|
|
|
"state" INTEGER default NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
|
|
|
|
"action" INTEGER default NULL REFERENCES "tblWorkflowActions" ("id") ON DELETE CASCADE,
|
|
|
|
"nextstate" INTEGER default NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
|
|
|
|
"maxtime" INTEGER DEFAULT 0
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow transition users
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowTransitionUsers" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE,
|
|
|
|
"userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow transition groups
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowTransitionGroups" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE,
|
|
|
|
"groupid" INTEGER default NULL REFERENCES "tblGroups" ("id") ON DELETE CASCADE,
|
|
|
|
"minusers" INTEGER default NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for workflow document relation
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowDocumentContent" (
|
2018-04-04 15:07:25 +00:00
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"parent" INTEGER DEFAULT NULL REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE,
|
2017-02-13 19:09:43 +00:00
|
|
|
"workflow" INTEGER DEFAULT NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
|
|
|
|
"document" INTEGER DEFAULT NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER DEFAULT NULL,
|
|
|
|
"state" INTEGER DEFAULT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
|
|
|
|
"date" TIMESTAMP default NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2018-11-16 14:41:26 +00:00
|
|
|
--
|
|
|
|
-- Table structure for workflow log
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowLog" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"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,
|
|
|
|
"comment" text
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
|
|
|
-- Table structure for mandatory workflows
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblWorkflowMandatoryWorkflow" (
|
|
|
|
"userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
|
|
|
|
UNIQUE(userid, workflow)
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 21:05:15 +00:00
|
|
|
--
|
|
|
|
-- Table structure for transmittal
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblTransmittals" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" text NOT NULL,
|
|
|
|
"comment" text NOT NULL,
|
|
|
|
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
|
|
|
|
"date" TIMESTAMP default NULL,
|
|
|
|
"public" INTEGER NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for transmittal item
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblTransmittalItems" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"transmittal" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblTransmittals" ("id") ON DELETE CASCADE,
|
|
|
|
"document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
|
|
|
|
"version" INTEGER NOT NULL default '0',
|
|
|
|
"date" TIMESTAMP default NULL,
|
|
|
|
UNIQUE (transmittal, document, version)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for access request objects
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblAros" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"parent" INTEGER,
|
|
|
|
"model" TEXT NOT NULL,
|
|
|
|
"foreignid" INTEGER NOT NULL DEFAULT '0',
|
|
|
|
"alias" TEXT
|
|
|
|
) ;
|
|
|
|
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for access control objects
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblAcos" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"parent" INTEGER,
|
|
|
|
"model" TEXT NOT NULL,
|
|
|
|
"foreignid" INTEGER NOT NULL DEFAULT '0',
|
|
|
|
"alias" TEXT
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for acos/aros relation
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblArosAcos" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"aro" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAros" ("id") ON DELETE CASCADE,
|
|
|
|
"aco" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAcos" ("id") ON DELETE CASCADE,
|
|
|
|
"create" INTEGER NOT NULL DEFAULT '-1',
|
|
|
|
"read" INTEGER NOT NULL DEFAULT '-1',
|
|
|
|
"update" INTEGER NOT NULL DEFAULT '-1',
|
|
|
|
"delete" INTEGER NOT NULL DEFAULT '-1',
|
|
|
|
UNIQUE (aco, aro)
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2018-04-04 13:29:32 +00:00
|
|
|
--
|
|
|
|
-- Table structure for tblSchedulerTask
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblSchedulerTask" (
|
|
|
|
"id" SERIAL UNIQUE,
|
|
|
|
"name" varchar(100) DEFAULT NULL,
|
|
|
|
"description" TEXT DEFAULT NULL,
|
|
|
|
"disabled" INTEGER NOT NULL DEFAULT '0',
|
|
|
|
"extension" varchar(100) DEFAULT NULL,
|
|
|
|
"task" varchar(100) DEFAULT NULL,
|
|
|
|
"frequency" varchar(100) DEFAULT NULL,
|
|
|
|
"params" TEXT DEFAULT NULL,
|
|
|
|
"nextrun" TIMESTAMP DEFAULT NULL,
|
|
|
|
"lastrun" TIMESTAMP DEFAULT NULL
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2017-02-13 19:09:43 +00:00
|
|
|
--
|
|
|
|
-- Table structure for version
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE "tblVersion" (
|
2017-02-20 13:56:25 +00:00
|
|
|
"date" TIMESTAMP NOT NULL,
|
2017-02-13 19:09:43 +00:00
|
|
|
"major" INTEGER,
|
|
|
|
"minor" INTEGER,
|
|
|
|
"subminor" INTEGER
|
|
|
|
) ;
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Initial content for database
|
|
|
|
--
|
|
|
|
|
2017-02-13 21:05:15 +00:00
|
|
|
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (1, 'Admin', 1);
|
2017-02-14 20:06:06 +00:00
|
|
|
SELECT nextval('"tblRoles_id_seq"');
|
2017-02-13 21:05:15 +00:00
|
|
|
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (2, 'Guest', 2);
|
2017-02-14 20:06:06 +00:00
|
|
|
SELECT nextval('"tblRoles_id_seq"');
|
2017-02-13 21:05:15 +00:00
|
|
|
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (3, 'User', 0);
|
2017-02-14 20:06:06 +00:00
|
|
|
SELECT nextval('"tblRoles_id_seq"');
|
2024-04-21 11:38:33 +00:00
|
|
|
INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, NULL, 0, 0, 0, NULL);
|
2017-02-15 07:26:12 +00:00
|
|
|
SELECT nextval('"tblUsers_id_seq"');
|
2017-02-13 21:05:15 +00:00
|
|
|
INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, '', 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL);
|
2017-02-15 07:26:12 +00:00
|
|
|
SELECT nextval('"tblUsers_id_seq"');
|
2017-02-13 19:09:43 +00:00
|
|
|
INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0);
|
2017-02-15 07:26:12 +00:00
|
|
|
SELECT nextval('"tblFolders_id_seq"');
|
2017-02-21 05:34:22 +00:00
|
|
|
INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 6, 0, 0);
|