add reference from tblUsers:homefolder to tblFolders:id

This commit is contained in:
Uwe Steinmann 2015-08-05 18:19:42 +02:00
parent 1e17c393bb
commit 0342e2a89d
4 changed files with 7 additions and 5 deletions

View File

@ -65,9 +65,10 @@ CREATE TABLE `tblUsers` (
`loginfailures` tinyint(4) NOT NULL default '0',
`disabled` smallint(1) NOT NULL default '0',
`quota` bigint,
`homefolder` int(11) default '0',
`homefolder` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE (`login`)
UNIQUE (`login`),
CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View File

@ -62,7 +62,7 @@ CREATE TABLE `tblUsers` (
`loginfailures` INTEGER NOT NULL default '0',
`disabled` INTEGER NOT NULL default '0',
`quota` INTEGER,
`homefolder` INTEGER default '0',
`homefolder` INTEGER default NULL REFERENCES `tblFolders` (`id`),
UNIQUE (`login`)
);

View File

@ -1,6 +1,6 @@
BEGIN;
ALTER TABLE tblUsers ADD COLUMN `homefolder` INTEGER DEFAULT 0;
ALTER TABLE tblUsers ADD COLUMN `homefolder` INTEGER DEFAULT NULL REFERENCES `tblFolders` (`id`);
UPDATE tblVersion set major=5, minor=0, subminor=0;

View File

@ -1,6 +1,7 @@
START TRANSACTION;
ALTER TABLE tblUsers ADD COLUMN `homefolder` INTEGER DEFAULT 0;
ALTER TABLE `tblUsers` ADD COLUMN `homefolder` INTEGER DEFAULT NULL;
ALTER TABLE `tblUsers` ADD CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`);
UPDATE tblVersion set major=5, minor=0, subminor=0;