fix sql tables for tblLinkType

This commit is contained in:
Uwe Steinmann 2024-06-20 17:18:55 +02:00
parent e094e8bae6
commit 36aedc8fd7
6 changed files with 47 additions and 6 deletions

View File

@ -362,6 +362,19 @@ CREATE TABLE `tblDocumentContentAttributes` (
-- --------------------------------------------------------
--
-- Table structure for table `tblLinkType`
--
CREATE TABLE `tblLinkType` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`color` char(8) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentLinks`
--
@ -372,13 +385,15 @@ CREATE TABLE `tblDocumentLinks` (
`target` int(11) NOT NULL DEFAULT '0',
`userID` int(11) NOT NULL DEFAULT '0',
`public` tinyint(1) NOT NULL DEFAULT '0',
`linktype` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `tblDocumentLinks_document` (`document`),
KEY `tblDocumentLinks_target` (`target`),
KEY `tblDocumentLinks_user` (`userID`),
CONSTRAINT `tblDocumentLinks_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentLinks_target` FOREIGN KEY (`target`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentLinks_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`)
CONSTRAINT `tblDocumentLinks_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`),
CONSTRAINT `tblDocumentLinks_linktype` FOREIGN KEY (`linktype`) REFERENCES `tblLinkType` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View File

@ -305,6 +305,18 @@ CREATE TABLE "tblDocumentContentAttributes" (
-- --------------------------------------------------------
--
-- Table structure for table "tblLinkType"
--
CREATE TABLE "tblLinkType" (
"id" SERIAL UNIQUE,
"name" text NOT NULL,
"color" char(8) DEFAULT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table "tblDocumentLinks"
--
@ -314,7 +326,8 @@ CREATE TABLE "tblDocumentLinks" (
"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
"public" INTEGER NOT NULL default 0,
"linktype" INTEGER NOT NULL default 0 REFERENCES "tblLinkType" ("id")
) ;
-- --------------------------------------------------------

View File

@ -307,6 +307,18 @@ CREATE TABLE `tblDocumentContentAttributes` (
-- --------------------------------------------------------
--
-- Table structure for table `tblLinkType`
--
CREATE TABLE `tblLinkType` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` text NOT NULL,
`color` char(8) DEFAULT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentLinks`
--
@ -316,7 +328,8 @@ CREATE TABLE `tblDocumentLinks` (
`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
`public` INTEGER NOT NULL default 0,
`linktype` INTEGER NOT NULL default 0 REFERENCES `tblLinkType` (`id`)
) ;
-- --------------------------------------------------------

View File

@ -64,7 +64,7 @@ CREATE TABLE "tblLinkType" (
"color" char(8) DEFAULT NULL
);
ALTER TABLE "tblDocumentLinks" ADD COLUMN "linktype" INTEGER DEFAULT NULL REFERENCES tblLinkType("id") ON DELETE CASCADE;
ALTER TABLE "tblDocumentLinks" ADD COLUMN "linktype" INTEGER DEFAULT NULL REFERENCES tblLinkType("id");
UPDATE "tblVersion" set "major"=6, "minor"=1, "subminor"=0, "module"='core';

View File

@ -110,7 +110,7 @@ CREATE TABLE `tblLinkType` (
`color` char(8) DEFAULT NULL
);
ALTER TABLE `tblDocumentLinks` ADD COLUMN `linktype` INTEGER DEFAULT NULL REFERENCES tblLinkType(`id`) ON DELETE CASCADE;
ALTER TABLE `tblDocumentLinks` ADD COLUMN `linktype` INTEGER DEFAULT NULL REFERENCES tblLinkType(`id`);
UPDATE `tblVersion` set `major`=6, `minor`=1, `subminor`=0, `module`='core';

View File

@ -74,7 +74,7 @@ CREATE TABLE `tblLinkType` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tblDocumentLinks` ADD COLUMN `linktype` int(11) DEFAULT NULL, ADD FOREIGN KEY tblDocumentLinks_linktype(`linktype`) REFERENCES tblLinkType(`id`) ON DELETE CASCADE;
ALTER TABLE `tblDocumentLinks` ADD COLUMN `linktype` int(11) DEFAULT NULL, ADD FOREIGN KEY tblDocumentLinks_linktype(`linktype`) REFERENCES tblLinkType(`id`);
UPDATE `tblVersion` set `major`=6, `minor`=1, `subminor`=0, `module`='core';