add constraint tblUsers_homefolder after creating tblFolders

set homefolder to NULL when creating initial users
This commit is contained in:
Uwe Steinmann 2015-09-14 18:18:52 +02:00
parent 78b39a24c5
commit 524e361439

View File

@ -67,8 +67,7 @@ CREATE TABLE `tblUsers` (
`quota` bigint,
`homefolder` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE (`login`),
CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`)
UNIQUE (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@ -138,6 +137,8 @@ CREATE TABLE `tblFolders` (
CONSTRAINT `tblFolders_owner` FOREIGN KEY (`owner`) REFERENCES `tblUsers` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tblUsers ADD CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`);
-- --------------------------------------------------------
--
@ -710,8 +711,8 @@ CREATE TABLE `tblVersion` (
-- Initial content for database
--
INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '0000-00-00 00:00:00', 0, 0, 0, 0);
INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '0000-00-00 00:00:00', 0, 0, 0, 0);
INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '0000-00-00 00:00:00', 0, 0, 0, NULL);
INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '0000-00-00 00:00:00', 0, 0, 0, NULL);
INSERT INTO tblFolders VALUES (1, 'DMS', 0, '', 'DMS root', UNIX_TIMESTAMP(), 1, 0, 2, 0);
INSERT INTO tblVersion VALUES (NOW(), 5, 0, 0);
INSERT INTO tblCategory VALUES (0, '');