fix updating tblDocumentFiles

This commit is contained in:
Uwe Steinmann 2021-07-21 15:24:50 +02:00
parent 51c342b5e3
commit c1e794dc4f

View File

@ -51,7 +51,9 @@ ALTER TABLE `new_tblDocumentContent` RENAME TO `tblDocumentContent`;
CREATE TABLE `new_tblDocumentFiles` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`document` INTEGER NOT NULL default 0 REFERENCES `tblDocuments` (`id`),
`version` INTEGER unsigned NOT NULL default '0',
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`),
`public` INTEGER NOT NULL default '0',
`comment` text,
`name` varchar(150) default NULL,
`date` INTEGER default NULL,
@ -61,16 +63,12 @@ CREATE TABLE `new_tblDocumentFiles` (
`mimeType` varchar(100) NOT NULL default ''
) ;
INSERT INTO `new_tblDocumentFiles` SELECT * FROM `tblDocumentFiles`;
INSERT INTO `new_tblDocumentFiles` SELECT `id`, `document`, 0, `userID`, 0, `comment`, `name`, `date`, `dir`, `orgFileName`, `fileType`, `mimeType` FROM `tblDocumentFiles`;
DROP TABLE `tblDocumentFiles`;
ALTER TABLE `new_tblDocumentFiles` RENAME TO `tblDocumentFiles`;
ALTER TABLE `tblDocumentFiles` ADD COLUMN `version` INTEGER unsigned NOT NULL DEFAULT '0';
ALTER TABLE `tblDocumentFiles` ADD COLUMN `public` INTEGER unsigned NOT NULL DEFAULT '0';
CREATE TABLE `new_tblUsers` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`login` varchar(50) default NULL,